From 3c95e5ae146a28b73781fdcb79dfd97fcc4550b4 Mon Sep 17 00:00:00 2001 From: Brewhouse Digital <66521220+brewhousedigital@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:51:57 -0600 Subject: [PATCH] Dashboard - Initial Database Refactor (#338) * Added a bunch of documentation for the env files * Removed the logging from the Dashboard * Dashboard - Initial Refactor of database calls --- .../login-register/LoginForm.svelte | 15 +++-- .../NewInstanceProcessingBlock.svelte | 9 +-- .../dashboard/src/routes/login/+page.svelte | 9 ++- .../routes/login/confirm-account/+page.svelte | 13 ++-- .../dashboard/src/routes/signup/+page.svelte | 14 ++-- frontends/dashboard/src/util/database.ts | 65 +++---------------- frontends/dashboard/src/util/utilities.ts | 12 ---- 7 files changed, 40 insertions(+), 97 deletions(-) delete mode 100644 frontends/dashboard/src/util/utilities.ts 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 @@