18.13 Show a Loading Overlay when Logging In

This commit is contained in:
Fredrick W. Warren 2021-02-14 21:51:51 -08:00
parent e12277da94
commit f84098008b
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import { Dialog } from 'quasar' import { Dialog, Loading } from 'quasar'
export function showErrorMessage (errorMessage) { export function showErrorMessage (errorMessage) {
Loading.hide()
Dialog.create({ Dialog.create({
title: 'Error', title: 'Error',
message: errorMessage message: errorMessage

View File

@ -1,4 +1,4 @@
import { LocalStorage } from 'quasar' import { LocalStorage, Loading } from 'quasar'
import { firebaseAuth } from 'boot/firebase' import { firebaseAuth } from 'boot/firebase'
import { showErrorMessage } from 'src/functions/function-show-error-message' import { showErrorMessage } from 'src/functions/function-show-error-message'
@ -15,6 +15,7 @@ const mutations = {
const actions = { const actions = {
registerUser ({ commit }, payload) { registerUser ({ commit }, payload) {
Loading.show()
firebaseAuth.createUserWithEmailAndPassword(payload.email, payload.password) firebaseAuth.createUserWithEmailAndPassword(payload.email, payload.password)
.then(response => { .then(response => {
console.log('response: ', response) console.log('response: ', response)
@ -24,6 +25,7 @@ const actions = {
}) })
}, },
loginUser ({ commit }, payload) { loginUser ({ commit }, payload) {
Loading.show()
firebaseAuth.signInWithEmailAndPassword(payload.email, payload.password) firebaseAuth.signInWithEmailAndPassword(payload.email, payload.password)
.then(response => { .then(response => {
console.log('response: ', response) console.log('response: ', response)
@ -37,6 +39,7 @@ const actions = {
}, },
handleAuthStateChange ({ commit }) { handleAuthStateChange ({ commit }) {
firebaseAuth.onAuthStateChanged(user => { firebaseAuth.onAuthStateChanged(user => {
Loading.hide()
if (user) { if (user) {
commit('setLoggedIn', true) commit('setLoggedIn', true)
/* eslint handle-callback-err: "off" */ /* eslint handle-callback-err: "off" */