import { useUser } from "@auth0/nextjs-auth0/client"; import { getAccessToken } from "@auth0/nextjs-auth0"; import Layout from "../components/layout"; import { Grid, Button, Typography, TextField, Box } from "@mui/material"; import { useState, useEffect } from "react"; const SellerDashoard = (ctx) => { const { user, isLoading } = useUser(); const [sellerData, setSellerData] = useState([]); const [loading, setLoading] = useState(true); // State for loading indicator useEffect(() => { const getData = async () => { const response = await fetch('/api/sellers/profile'); const sellerProfile = await response.json(); setSellerData(sellerProfile); setLoading(false); // Once data is fetched, set loading to false } getData(); }, []); return ( {(Object.keys(sellerData).length>0) ? ( <> Seller Dashboard TODO ) : ( {/* */} )} ); }; export default SellerDashoard;