From f84098008bedf6a2e3a96f1854ed6df81a2ff806 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Sun, 14 Feb 2021 21:51:51 -0800 Subject: [PATCH] 18.13 Show a Loading Overlay when Logging In --- src/functions/function-show-error-message.js | 3 ++- src/store/store-auth.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/functions/function-show-error-message.js b/src/functions/function-show-error-message.js index 1aacce4..21fb5ca 100644 --- a/src/functions/function-show-error-message.js +++ b/src/functions/function-show-error-message.js @@ -1,6 +1,7 @@ -import { Dialog } from 'quasar' +import { Dialog, Loading } from 'quasar' export function showErrorMessage (errorMessage) { + Loading.hide() Dialog.create({ title: 'Error', message: errorMessage diff --git a/src/store/store-auth.js b/src/store/store-auth.js index a86044c..8d39215 100644 --- a/src/store/store-auth.js +++ b/src/store/store-auth.js @@ -1,4 +1,4 @@ -import { LocalStorage } from 'quasar' +import { LocalStorage, Loading } from 'quasar' import { firebaseAuth } from 'boot/firebase' import { showErrorMessage } from 'src/functions/function-show-error-message' @@ -15,6 +15,7 @@ const mutations = { const actions = { registerUser ({ commit }, payload) { + Loading.show() firebaseAuth.createUserWithEmailAndPassword(payload.email, payload.password) .then(response => { console.log('response: ', response) @@ -24,6 +25,7 @@ const actions = { }) }, loginUser ({ commit }, payload) { + Loading.show() firebaseAuth.signInWithEmailAndPassword(payload.email, payload.password) .then(response => { console.log('response: ', response) @@ -37,6 +39,7 @@ const actions = { }, handleAuthStateChange ({ commit }) { firebaseAuth.onAuthStateChanged(user => { + Loading.hide() if (user) { commit('setLoggedIn', true) /* eslint handle-callback-err: "off" */