summaryrefslogtreecommitdiffstats
path: root/webapp/src/main.js
diff options
context:
space:
mode:
authorJannik Schönartz2018-07-02 22:39:23 +0200
committerJannik Schönartz2018-07-02 22:39:23 +0200
commit718f9b58331f4a9bee5eba3296329cc58b4364a6 (patch)
tree63e0048923f1a2a4f4fc44ef9aec0e7c51a967e1 /webapp/src/main.js
parent[server] Initial commit to add the node server stuff. (diff)
downloadbas-718f9b58331f4a9bee5eba3296329cc58b4364a6.tar.gz
bas-718f9b58331f4a9bee5eba3296329cc58b4364a6.tar.xz
bas-718f9b58331f4a9bee5eba3296329cc58b4364a6.zip
[webapp] Initial commit to add the node webapp stuff.
Diffstat (limited to 'webapp/src/main.js')
-rw-r--r--webapp/src/main.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/webapp/src/main.js b/webapp/src/main.js
new file mode 100644
index 0000000..4a553aa
--- /dev/null
+++ b/webapp/src/main.js
@@ -0,0 +1,42 @@
+import Vue from 'vue'
+import Vuetify from 'vuetify'
+import 'vuetify/dist/vuetify.min.css'
+import VueTouch from 'vue-touch'
+import store from './store'
+import axios from 'axios'
+import router from './router'
+import VueI18n from 'vue-i18n'
+import '@/assets/styles.css'
+
+Vue.config.productionTip = false
+
+Vue.use(Vuetify, {
+ theme: {
+ primary: '#0195ff'
+ }
+})
+
+Vue.use(VueTouch)
+
+Vue.use(VueI18n)
+
+const i18n = new VueI18n({
+ locale: store.state.locale
+})
+
+axios.interceptors.response.use(null, error => {
+ if (error.response.data.status === 'TOKEN_INVALID' || error.response.data.status === 'TOKEN_MISSING') {
+ axios.post('/api/logout').then(response => { router.push('/login') })
+ }
+ return Promise.reject(error)
+})
+Vue.prototype.$http = axios
+
+new Vue({
+ store,
+ router,
+ i18n,
+ computed: { locale: () => store.state.locale },
+ watch: { locale: v => { i18n.locale = v } },
+ template: '<router-view/>'
+}).$mount('#app')