18.07 Logout Button - Log the User Out

This commit is contained in:
fwarren committed 2021-02-13 19:46:06 -08:00
1 parent e127886523
commit 27563c4d21
2 files changed
+6 -1

No files matched your search

+3 -1
View File
@@ -15,6 +15,7 @@
/> />
<q-btn <q-btn
v-else v-else
@click="logoutUser"
flat flat
icon-right="account_circle" icon-right="account_circle"
label="Logout" label="Logout"
@@ -65,7 +66,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'MainLayout', name: 'MainLayout',
@@ -93,6 +94,7 @@ export default {
...mapState('auth', ['loggedIn']) ...mapState('auth', ['loggedIn'])
}, },
methods: { methods: {
...mapActions('auth', ['logoutUser'])
} }
} }
</script> </script>
+3
View File
@@ -29,6 +29,9 @@ const actions = {
console.log('error.message: ', error) console.log('error.message: ', error)
}) })
}, },
logoutUser () {
firebaseAuth.signOut()
},
handleAuthStateChange ({ commit }) { handleAuthStateChange ({ commit }) {
firebaseAuth.onAuthStateChanged(function (user) { firebaseAuth.onAuthStateChanged(function (user) {
if (user) { if (user) {