changes after second dev test

fixed full name issue, refresh issue on reservation and user/admin login issue
This commit is contained in:
belviskhoremk
2026-05-27 23:04:32 +00:00
parent 209ac114b0
commit 53365b9dbf
7 changed files with 60 additions and 27 deletions

View File

@@ -13,6 +13,7 @@ interface AuthContextType {
login: (email: string, password: string) => Promise<UserProfile>;
register: (email: string, password: string, name: string) => Promise<UserProfile | null>;
logout: () => void;
refreshUser: () => Promise<void>;
}
const AuthContext = createContext<AuthContextType | undefined>(undefined);
@@ -50,6 +51,11 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
setUser(null);
};
const refreshUser = async () => {
const profile = await authApi.getMe();
setUser(profile);
};
return (
<AuthContext.Provider
value={{
@@ -59,6 +65,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
login,
register,
logout,
refreshUser,
}}
>
{children}