api-client/components/firebase/Logout.vue

48 lines
927 B
Vue
Raw Normal View History

2020-03-05 01:18:10 +00:00
<template>
2021-07-05 16:52:15 +00:00
<div class="flex">
<SmartItem
2021-07-03 13:14:58 +00:00
icon="exit_to_app"
:label="$t('logout')"
2021-07-05 16:52:15 +00:00
@click.native="
$emit('confirm-logout')
confirmLogout = true
"
/>
<SmartConfirmModal
:show="confirmLogout"
2021-08-02 15:27:18 +00:00
:title="$t('confirm.logout')"
2021-07-05 16:52:15 +00:00
@hide-modal="confirmLogout = false"
@resolve="logout"
2021-07-03 13:14:58 +00:00
/>
2020-03-05 01:18:10 +00:00
</div>
</template>
2021-06-14 04:07:30 +00:00
<script lang="ts">
import Vue from "vue"
import { signOutUser } from "~/helpers/fb/auth"
2020-03-05 01:18:10 +00:00
2021-06-14 04:07:30 +00:00
export default Vue.extend({
2021-07-05 16:52:15 +00:00
data() {
return {
confirmLogout: false,
}
},
2020-03-05 01:18:10 +00:00
methods: {
async logout() {
try {
2021-06-14 04:07:30 +00:00
await signOutUser()
2021-06-14 04:07:30 +00:00
this.$toast.info(this.$t("logged_out").toString(), {
icon: "vpn_key",
})
} catch (e) {
console.error(e)
this.$toast.error(this.$t("error.something_went_wrong").toString(), {
icon: "error",
2020-03-05 01:18:10 +00:00
})
}
2020-03-05 01:18:10 +00:00
},
},
2021-06-14 04:07:30 +00:00
})
2020-03-05 01:18:10 +00:00
</script>