20 lines
433 B
TypeScript
20 lines
433 B
TypeScript
|
|
import { createContext } from 'react';
|
||
|
|
import type { User } from './types';
|
||
|
|
|
||
|
|
export interface AuthContextValue {
|
||
|
|
user: User | null;
|
||
|
|
token: string | null;
|
||
|
|
loading: boolean;
|
||
|
|
login: (googleToken: string) => Promise<void>;
|
||
|
|
devLogin?: () => void;
|
||
|
|
logout: () => void;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const AuthContext = createContext<AuthContextValue>({
|
||
|
|
user: null,
|
||
|
|
token: null,
|
||
|
|
loading: true,
|
||
|
|
login: async () => {},
|
||
|
|
logout: () => {},
|
||
|
|
});
|