fix: disable accept button if still fetching user details

This commit is contained in:
Rotimi Best
2025-09-10 20:39:16 +01:00
parent 47563410d8
commit 98acd93133
3 changed files with 9 additions and 9 deletions
@@ -18,8 +18,6 @@
export let hideGoogleAuth = false; export let hideGoogleAuth = false;
export let redirectPathname = ''; export let redirectPathname = '';
$: console.log('redirectPathname', redirectPathname);
async function signInWithGoogle() { async function signInWithGoogle() {
if (isLoading) { if (isLoading) {
return; return;
+3 -3
View File
@@ -1,6 +1,6 @@
import { writable } from 'svelte/store';
import type { User } from '@supabase/supabase-js';
import { LOCALE } from '../types'; import { LOCALE } from '../types';
import type { User } from '@supabase/supabase-js';
import { writable } from 'svelte/store';
interface UserStore { interface UserStore {
openAuthModal: boolean; openAuthModal: boolean;
@@ -29,7 +29,7 @@ interface ProfileStore {
export const defaultUserState: UserStore = { export const defaultUserState: UserStore = {
openAuthModal: false, openAuthModal: false,
fetchingUser: false, fetchingUser: true,
isLoggedIn: false, isLoggedIn: false,
currentSession: undefined, currentSession: undefined,
expiresAt: 0 expiresAt: 0
@@ -11,7 +11,7 @@
import { getSupabase } from '$lib/utils/functions/supabase'; import { getSupabase } from '$lib/utils/functions/supabase';
import { setTheme } from '$lib/utils/functions/theme'; import { setTheme } from '$lib/utils/functions/theme';
import { t } from '$lib/utils/functions/translations'; import { t } from '$lib/utils/functions/translations';
import { profile } from '$lib/utils/store/user'; import { profile, user } from '$lib/utils/store/user';
import { import {
authValidation, authValidation,
getConfirmPasswordError, getConfirmPasswordError,
@@ -176,6 +176,8 @@
shouldLogout = true; shouldLogout = true;
} }
} }
$: isLoading = loading || $user.fetchingUser;
</script> </script>
<svelte:head> <svelte:head>
@@ -187,7 +189,7 @@
redirectPathname={$page.url.pathname} redirectPathname={$page.url.pathname}
isLogin={false} isLogin={false}
{handleSubmit} {handleSubmit}
isLoading={loading} {isLoading}
showLogo={true} showLogo={true}
bind:formRef bind:formRef
> >
@@ -276,8 +278,8 @@
label="Accept Invite" label="Accept Invite"
type="submit" type="submit"
className="sm:w-full w-full" className="sm:w-full w-full"
isDisabled={disableSubmit || loading} isDisabled={disableSubmit}
isLoading={loading} {isLoading}
/> />
{/if} {/if}
</div> </div>