fix: auth flow bug on joining course

This commit is contained in:
Rotimi Best
2023-12-05 08:31:26 +03:00
parent 8fc3a5e1fc
commit 6fa1d0fcfb
12 changed files with 69 additions and 86 deletions
+19 -11
View File
@@ -1,21 +1,15 @@
import { writable } from 'svelte/store';
import type { User } from '@supabase/supabase-js';
export const user = writable<{
interface UserStore {
openAuthModal: boolean;
fetchingUser: boolean;
isLoggedIn: boolean;
currentSession: User | undefined;
expiresAt: number;
}>({
openAuthModal: false,
fetchingUser: false,
isLoggedIn: false,
currentSession: undefined,
expiresAt: 0
});
}
export const profile = writable<{
interface ProfileStore {
id: string | undefined;
fullname: string;
avatar_url: string;
@@ -27,7 +21,17 @@ export const profile = writable<{
goal: string;
source: string;
telegram_chat_id: number | null;
}>({
}
export const defaultUserState: UserStore = {
openAuthModal: false,
fetchingUser: false,
isLoggedIn: false,
currentSession: undefined,
expiresAt: 0
};
export const defaultProfileState: ProfileStore = {
id: undefined,
fullname: '',
avatar_url: 'https://pbs.twimg.com/profile_images/1416443682157473795/dGtFbtht_normal.jpg',
@@ -38,4 +42,8 @@ export const profile = writable<{
goal: '',
source: '',
telegram_chat_id: null
});
};
export const user = writable<UserStore>(defaultUserState);
export const profile = writable<ProfileStore>(defaultProfileState);