fix: auth flow bug on joining course
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user