mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 21:57:47 +02:00
Move reusable stuff to vue mixin
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="$route.name === 'settings'" class="content has-text-centered is-size-6">
|
||||
<a class="has-text-grey" href="https://github.com/Bubka/2FAuth"><b>2FAuth</b> <font-awesome-icon :icon="['fab', 'github-alt']" /></a> - v{{ $root.appVersion }}
|
||||
<a class="has-text-grey" href="https://github.com/Bubka/2FAuth"><b>2FAuth</b> <font-awesome-icon :icon="['fab', 'github-alt']" /></a> - v{{ appVersion }}
|
||||
</div>
|
||||
<div v-else class="content has-text-centered">
|
||||
<router-link :to="{ name: 'settings' }" class="has-text-grey">{{ $t('settings.settings') }}</router-link> - <a class="has-text-grey" @click="logout">{{ $t('auth.sign_out') }}</a>
|
||||
@ -30,21 +30,12 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
async logout(evt) {
|
||||
logout() {
|
||||
if(confirm(this.$t('auth.confirm.logout'))) {
|
||||
|
||||
await this.axios.get('api/logout')
|
||||
|
||||
localStorage.removeItem('jwt')
|
||||
localStorage.removeItem('user')
|
||||
|
||||
delete this.axios.defaults.headers.common['Authorization']
|
||||
|
||||
this.$router.push({ name: 'login' })
|
||||
this.appLogout()
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user