File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change 11// hooks/useAuth.ts
2- import { useContext } from " react" ;
3- import { AuthContext } from " @/providers/AuthProvider" ;
2+ import { useContext } from ' react' ;
3+ import { AuthContext } from ' @/providers/AuthProvider' ;
44
55export interface AuthUser {
6- idToken : string ;
7- user : {
8- id : string ;
9- name : string | null ;
10- email : string ;
11- photo : string | null ;
12- familyName : string | null ;
13- givenName : string | null ;
14- } ;
6+ idToken : string ;
7+ accessToken ?: string ;
8+ refreshToken ?: string ;
9+ user : {
10+ id : string ;
11+ name : string | null ;
12+ email : string ;
13+ photo : string | null ;
14+ familyName : string | null ;
15+ givenName : string | null ;
16+ } ;
1517}
1618
1719export type AuthContextType = {
18- user : AuthUser | null ;
19- setUser : React . Dispatch < React . SetStateAction < AuthUser | null > > ;
20+ user : AuthUser | null ;
21+ setUser : React . Dispatch < React . SetStateAction < AuthUser | null > > ;
2022} ;
2123
2224export function useAuth ( ) : AuthContextType {
23- const ctx = useContext ( AuthContext ) ;
24- if ( ! ctx ) {
25- throw new Error ( " useAuth must be used within <AuthProvider>" ) ;
26- }
27- return ctx ;
25+ const ctx = useContext ( AuthContext ) ;
26+ if ( ! ctx ) {
27+ throw new Error ( ' useAuth must be used within <AuthProvider>' ) ;
28+ }
29+ return ctx ;
2830}
You can’t perform that action at this time.
0 commit comments