diff --git a/resources/js/app.js b/resources/js/app.js
index f434af8f..95745d5f 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -15,8 +15,7 @@ Vue.use(Notifications)
const app = new Vue({
el: '#app',
data: {
- appSettings: window.appSettings,
- appVersion: window.appVersion
+ appSettings: window.appSettings
},
components: { App },
i18n,
diff --git a/resources/js/components/Footer.vue b/resources/js/components/Footer.vue
index b29db082..866073a9 100644
--- a/resources/js/components/Footer.vue
+++ b/resources/js/components/Footer.vue
@@ -8,7 +8,7 @@
-
2FAuth - v{{ $root.appVersion }}
+
2FAuth - v{{ appVersion }}
{{ $t('settings.settings') }} -
{{ $t('auth.sign_out') }}
@@ -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()
}
- },
-
+ }
}
};
diff --git a/resources/js/mixins.js b/resources/js/mixins.js
new file mode 100644
index 00000000..65870795
--- /dev/null
+++ b/resources/js/mixins.js
@@ -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' })
+ },
+ }
+
+})
\ No newline at end of file