diff --git a/src/routes/console/onboarding/+page.svelte b/src/routes/console/onboarding/+page.svelte index 4884a64eb..c0e0bb14c 100644 --- a/src/routes/console/onboarding/+page.svelte +++ b/src/routes/console/onboarding/+page.svelte @@ -15,6 +15,7 @@ let id: string; let showCustomId = false; let loading = false; + async function createProject() { try { loading = true; @@ -28,12 +29,11 @@ await invalidate(Dependencies.ACCOUNT); goto(`/console/project-${project.$id}`); } catch ({ message }) { + loading = false; addNotification({ message, type: 'error' }); - } finally { - loading = false; } } diff --git a/src/routes/console/organization-[organization]/createProject.svelte b/src/routes/console/organization-[organization]/createProject.svelte index 97afc677c..952850c44 100644 --- a/src/routes/console/organization-[organization]/createProject.svelte +++ b/src/routes/console/organization-[organization]/createProject.svelte @@ -18,7 +18,7 @@ let error: string; let isCreating = false; - const create = async () => { + async function create() { try { isCreating = true; const project = await sdkForConsole.projects.create( @@ -34,11 +34,10 @@ }); await goto(`/console/project-${project.$id}`); } catch ({ message }) { - error = message; - } finally { isCreating = false; + error = message; } - }; + } diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index 230fe63f1..95c257a5c 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -14,10 +14,11 @@ import { Unauthenticated } from '$lib/layout'; import { Dependencies } from '$lib/constants'; - let mail: string, pass: string; + let mail: string, pass: string, disabled: boolean; - const login = async () => { + async function login() { try { + disabled = true; await sdkForConsole.account.createEmailSession(mail, pass); await invalidate(Dependencies.ACCOUNT); addNotification({ @@ -26,12 +27,13 @@ }); await goto(`${base}/console`); } catch (error) { + disabled = false; addNotification({ type: 'error', message: error.message }); } - }; + } @@ -59,7 +61,7 @@ showPasswordButton={true} bind:value={pass} /> - + diff --git a/src/routes/register/+page.svelte b/src/routes/register/+page.svelte index f21c8af43..52c3611a2 100644 --- a/src/routes/register/+page.svelte +++ b/src/routes/register/+page.svelte @@ -16,22 +16,24 @@ import FormList from '$lib/elements/forms/formList.svelte'; import { Dependencies } from '$lib/constants'; - let name: string, mail: string, pass: string; + let name: string, mail: string, pass: string, disabled: boolean; let terms = false; - const register = async () => { + async function register() { try { + disabled = true; await sdkForConsole.account.create('unique()', mail, pass, name ?? ''); await sdkForConsole.account.createEmailSession(mail, pass); await invalidate(Dependencies.ACCOUNT); await goto(`${base}/console`); } catch (error) { + disabled = false; addNotification({ type: 'error', message: error.message }); } - }; + } @@ -77,7 +79,7 @@ rel="noopener noreferrer">General Terms of Use. - +