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

@@ -1,11 +1,13 @@
import GetUserSchema from '@/services/User/schema/GetUserSchema';
import { createContext } from 'react';
import { KeyedMutator } from 'swr';
import { z } from 'zod';
const UserContext = createContext<{
user?: z.infer<typeof GetUserSchema>;
error?: unknown;
isLoading: boolean;
mutate?: KeyedMutator<z.infer<typeof GetUserSchema>>;
}>({ isLoading: true });
export default UserContext;