Allow oriol.rodrigo@craze-group.com login and restrict to dashboard

This commit is contained in:
Christian Vidal Wolf
2026-07-14 15:59:11 +02:00
parent ea4592b695
commit 56593f942b
8 changed files with 210 additions and 44 deletions
+22
View File
@@ -25,6 +25,17 @@ export async function signUp(email: string, password: string): Promise<void> {
}
export async function signIn(email: string, password: string): Promise<AuthSession> {
if (email.trim().toLowerCase() === 'oriol.rodrigo@craze-group.com' && password === '@Craze2026') {
const session: AuthSession = {
access_token: 'mock-access-token-oriol',
refresh_token: 'mock-refresh-token-oriol',
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
};
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
window.dispatchEvent(new Event('session-refreshed'));
return session;
}
const response = await fetch(`${SUPABASE_URL}/auth/v1/token?grant_type=password`, {
method: 'POST',
headers: {
@@ -79,6 +90,17 @@ export async function signIn(email: string, password: string): Promise<AuthSessi
let activeRefreshPromise: Promise<AuthSession> | null = null;
export async function refreshSession(refreshToken: string): Promise<AuthSession> {
if (refreshToken === 'mock-refresh-token-oriol') {
const session: AuthSession = {
access_token: 'mock-access-token-oriol',
refresh_token: 'mock-refresh-token-oriol',
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
};
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
window.dispatchEvent(new Event('session-refreshed'));
return session;
}
if (activeRefreshPromise) {
return activeRefreshPromise;
}