Fix: Prevent logout on email change cancellation

This commit is contained in:
gpt-engineer-app[bot]
2025-10-01 16:39:52 +00:00
parent 882d06b70f
commit c00f991b1e
2 changed files with 9 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ interface AuthContextType {
pendingEmail: string | null;
signOut: () => Promise<void>;
refreshProfile: () => Promise<void>;
clearPendingEmail: () => void;
}
const AuthContext = createContext<AuthContextType | undefined>(undefined);
@@ -152,6 +153,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
}
};
const clearPendingEmail = () => {
setPendingEmail(null);
};
const value = {
user,
session,
@@ -160,6 +165,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
pendingEmail,
signOut,
refreshProfile,
clearPendingEmail,
};
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;