From 7fb047835174735d8bbe6a6d6dacfc0728864b3f Mon Sep 17 00:00:00 2001 From: James Scott Date: Thu, 15 Feb 2024 11:24:40 -0500 Subject: [PATCH] fix firefox login --- src/stores/authStore.js | 1 + src/views/LoginView.vue | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stores/authStore.js b/src/stores/authStore.js index 99738e8..b71edec 100644 --- a/src/stores/authStore.js +++ b/src/stores/authStore.js @@ -21,6 +21,7 @@ export const useAuthStore = defineStore({ await this.getGroup($api); router.push({ name: this.returnUrl || "home" }); } catch (error) { + if (!error.response) throw "The server encountered an error"; if (error.response.status == 401) { throw "Incorrect username or password"; } diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index af58877..2c8a2c7 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -6,7 +6,8 @@ let password = ref(""); let loginError = ref(""); const $api = inject("$api"); -async function handleLogin() { +async function handleLogin(e) { + e.preventDefault(); const authStore = useAuthStore(); try { await authStore.login(username, password, $api); @@ -33,7 +34,7 @@ async function handleLogin() { input.input(v-model="password" type="password" placeholder="password") span.icon.is-small.is-left font-awesome-icon(icon="fas fa-lock") - button.button.fancy-button.is-fullwidth(type="submit" @click="handleLogin()") Log In + button.button.fancy-button.is-fullwidth(type="submit" @click="handleLogin") Log In .has-text-danger p {{ loginError }}