fixed all admin email pages. added admin user info and button on builder page to route to admin page.
CI / test (push) Successful in 5s

This commit is contained in:
2026-01-26 14:58:56 -05:00
parent fb2effca47
commit 77c31ae4f9
15 changed files with 393 additions and 214 deletions
+11
View File
@@ -33,6 +33,7 @@ type AuthContextValue = {
register: (params: RegisterParams) => Promise<void>;
logout: () => void;
refreshUser: () => Promise<void>;
getAuthHeaders: () => HeadersInit;
};
const AuthContext = createContext<AuthContextValue | undefined>(undefined);
@@ -210,6 +211,15 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}).catch(() => {});
}, [persistUser]);
const getAuthHeaders = useCallback((): HeadersInit => {
if (typeof window === "undefined") return {};
const token =
localStorage.getItem("token") ||
localStorage.getItem("jwt") ||
localStorage.getItem("accessToken");
return token ? { Authorization: `Bearer ${token}` } : {};
}, []);
const value: AuthContextValue = {
user,
loading,
@@ -217,6 +227,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
register,
logout,
refreshUser,
getAuthHeaders,
};
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;