Initial commit
Next.js + Express event management app for Hope Family Church.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
role?: "admin" | "supervisor" | "staff" | "user";
|
||||
phoneNumber?: string | null;
|
||||
notificationPreference?: "email" | "whatsapp" | "both";
|
||||
};
|
||||
|
||||
export type AuthResponse = AuthUser & {
|
||||
token: string;
|
||||
};
|
||||
|
||||
const TOKEN_KEY = "hope_events_token";
|
||||
|
||||
export function saveToken(token: string) {
|
||||
if (typeof window !== "undefined") localStorage.setItem(TOKEN_KEY, token);
|
||||
}
|
||||
export function getToken(): string | null {
|
||||
if (typeof window === "undefined") return null;
|
||||
return localStorage.getItem(TOKEN_KEY);
|
||||
}
|
||||
export function clearToken() {
|
||||
if (typeof window !== "undefined") localStorage.removeItem(TOKEN_KEY);
|
||||
}
|
||||
Reference in New Issue
Block a user