mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 13:55:01 +02:00
Move reusable stuff to vue mixin
This commit is contained in:
26
resources/js/mixins.js
vendored
Normal file
26
resources/js/mixins.js
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.mixin({
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
appVersion: window.appVersion
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
async appLogout(evt) {
|
||||
|
||||
await this.axios.get('api/logout')
|
||||
|
||||
localStorage.removeItem('jwt')
|
||||
localStorage.removeItem('user')
|
||||
|
||||
delete this.axios.defaults.headers.common['Authorization']
|
||||
|
||||
this.$router.push({ name: 'login' })
|
||||
},
|
||||
}
|
||||
|
||||
})
|
Reference in New Issue
Block a user