frontend/context: introduce update internal auth user method
Parents:
17207311 file(s) changed
- frontend/context/AuthContext.tsx +11 -0
frontend/context/AuthContext.tsx
@@ -9,6 +9,12 @@ interface AuthContextType {
9 9 user: User | null;
10 10 isLoading: boolean;
11 11 isAuthenticated: boolean;
12 + updateAuthUser: (user: {
13 + firstName: string;
14 + lastName?: string;
15 + email: string;
16 + updatedAt: date;
17 + }) => void;
12 18 login: (email: string, password: string) => Promise<void>;
13 19 signup: (userData: {
14 20 firstName: string;
@@ -113,6 +119,10 @@ const resetPassword = async (token: string, password: string) => {
113 119 await apiClient.resetPassword(token, password);
114 120 };
115 121
122 + const updateAuthUser = (user) => {
123 + setUser(user);
124 + }
125 +
116 126 const value: AuthContextType = {
117 127 user,
118 128 isLoading,
@@ -122,6 +132,7 @@ signup,
122 132 logout,
123 133 forgotPassword,
124 134 resetPassword,
135 + updateAuthUser
125 136 };
126 137
127 138 return (