diff --git a/frontends/dashboard/src/components/login-register/LoginForm.svelte b/frontends/dashboard/src/components/login-register/LoginForm.svelte index fd6de750..39c488b2 100644 --- a/frontends/dashboard/src/components/login-register/LoginForm.svelte +++ b/frontends/dashboard/src/components/login-register/LoginForm.svelte @@ -16,19 +16,24 @@ let isButtonLoading: boolean = false // Toggle between registration and login forms - const handleLoginClick = () => { + const handleRegisterClick = () => { isSignUpView = !isSignUpView } // Handle the form submission const handleSubmit = async (e: SubmitEvent) => { e.preventDefault() + isFormButtonDisabled = true isButtonLoading = true + formError = '' - await handleLogin(email, password, (error) => { - formError = error - }) + try { + await handleLogin(email, password) + } catch (error) { + const e = error as Error + formError = `Something went wrong with logging you in. ${e.message}` + } isFormButtonDisabled = false isButtonLoading = false @@ -96,7 +101,7 @@ Need to Register? Create A New Account diff --git a/frontends/dashboard/src/components/login-register/NewInstanceProcessingBlock.svelte b/frontends/dashboard/src/components/login-register/NewInstanceProcessingBlock.svelte index 465d3fe8..dd6aff3e 100644 --- a/frontends/dashboard/src/components/login-register/NewInstanceProcessingBlock.svelte +++ b/frontends/dashboard/src/components/login-register/NewInstanceProcessingBlock.svelte @@ -1,12 +1,7 @@
diff --git a/frontends/dashboard/src/routes/login/+page.svelte b/frontends/dashboard/src/routes/login/+page.svelte index 393e3d7d..3aedefa3 100644 --- a/frontends/dashboard/src/routes/login/+page.svelte +++ b/frontends/dashboard/src/routes/login/+page.svelte @@ -14,9 +14,12 @@ isFormButtonDisabled = true - await handleLogin(email, password, (error) => { - formError = error - }) + try { + await handleLogin(email, password) + } catch (error) { + const e = error as Error + formError = `Something has gone wrong with logging in. ${e.message}` + } isFormButtonDisabled = false } diff --git a/frontends/dashboard/src/routes/login/confirm-account/+page.svelte b/frontends/dashboard/src/routes/login/confirm-account/+page.svelte index c5f4c56e..cc01a28f 100644 --- a/frontends/dashboard/src/routes/login/confirm-account/+page.svelte +++ b/frontends/dashboard/src/routes/login/confirm-account/+page.svelte @@ -19,12 +19,15 @@ } const handleLoad = async () => { - if (!token) { - throw new Error(`Expected valid token here`) + try { + await handleAccountConfirmation(token) + + // Refresh the app to get the latest info from the backend + window.location.href = '/' + } catch (error) { + const e = error as Error + formError = `Something went wrong with confirming your account. ${e.message}` } - await handleAccountConfirmation(token, (error) => { - formError = error - }) } diff --git a/frontends/dashboard/src/routes/signup/+page.svelte b/frontends/dashboard/src/routes/signup/+page.svelte index 16ca1ee4..fe591dfa 100644 --- a/frontends/dashboard/src/routes/signup/+page.svelte +++ b/frontends/dashboard/src/routes/signup/+page.svelte @@ -1,10 +1,6 @@