18.07 Logout Button - Log the User Out

This commit is contained in:
Fredrick W. Warren 2021-02-13 19:46:06 -08:00
parent e127886523
commit 27563c4d21
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@
/>
<q-btn
v-else
@click="logoutUser"
flat
icon-right="account_circle"
label="Logout"
@ -65,7 +66,7 @@
</template>
<script>
import { mapState } from 'vuex'
import { mapState, mapActions } from 'vuex'
export default {
name: 'MainLayout',
@ -93,6 +94,7 @@ export default {
...mapState('auth', ['loggedIn'])
},
methods: {
...mapActions('auth', ['logoutUser'])
}
}
</script>

View File

@ -29,6 +29,9 @@ const actions = {
console.log('error.message: ', error)
})
},
logoutUser () {
firebaseAuth.signOut()
},
handleAuthStateChange ({ commit }) {
firebaseAuth.onAuthStateChanged(function (user) {
if (user) {