Fix login glitch where user session wouldn't load properly into context

This commit is contained in:
Aaron William Po
2023-04-08 02:46:42 -04:00
parent 80bed9b4dc
commit cbc5671b0e
6 changed files with 20 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ const spaceGrotesk = Space_Grotesk({
});
export default function App({ Component, pageProps }: AppProps) {
const { user, isLoading, error } = useUser();
const { user, isLoading, error, mutate } = useUser();
return (
<>
@@ -21,7 +21,7 @@ export default function App({ Component, pageProps }: AppProps) {
}
`}
</style>
<UserContext.Provider value={{ user, isLoading, error }}>
<UserContext.Provider value={{ user, isLoading, error, mutate }}>
<Component {...pageProps} />
</UserContext.Provider>
</>

View File

@@ -11,9 +11,9 @@ const ProtectedPage: NextPage = () => {
const currentTime = new Date().getHours();
const isMorning = currentTime > 5 && currentTime < 12;
const isMorning = currentTime > 4 && currentTime < 12;
const isAfternoon = currentTime > 12 && currentTime < 18;
const isEvening = currentTime > 18 && currentTime < 24;
const isEvening = currentTime > 18 && currentTime < 24 || currentTime <4
return (
<Layout>