import Layout from '@/components/ui/Layout'; import Spinner from '@/components/ui/Spinner'; import withPageAuthRequired from '@/config/auth/withPageAuthRequired'; import UserContext from '@/contexts/userContext'; import { GetServerSideProps, NextPage } from 'next'; import { useContext } from 'react'; const ProtectedPage: NextPage = () => { const { user, error, isLoading } = useContext(UserContext); return (

Hello!

<> {isLoading && } {error &&

Something went wrong.

} {user && (

{user.username}

)}
); }; export const getServerSideProps: GetServerSideProps = withPageAuthRequired(); export default ProtectedPage;