gamebrary/src/components/Settings/SignOut.vue

30 lines
684 B
Vue
Raw Normal View History

2020-08-15 00:02:34 +00:00
<template lang="html">
2020-09-01 22:04:43 +00:00
<b-button @click="signOut" variant="dark">
2020-08-15 00:02:34 +00:00
{{ $t('settings.signOut') }}
2020-09-01 22:04:43 +00:00
</b-button>
2020-08-15 00:02:34 +00:00
</template>
<script>
import firebase from 'firebase/app';
import 'firebase/auth';
export default {
methods: {
signOut() {
firebase.auth().signOut()
.then(() => {
const exitUrl = process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://gamebrary.com';
this.$store.commit('CLEAR_SESSION');
window.location.href = exitUrl;
})
.catch((error) => {
this.$bvToast.toast(error, { title: 'Error', variant: 'danger' });
});
},
},
};
</script>