summaryrefslogblamecommitdiffstats
path: root/webapp/src/main.js
blob: 5d4f494d9d267e74c818f2c078989309e3727a10 (plain) (tree)






















                                     













                              

















                                                                                                         
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,
  silentTranslationWarn: true,
  messages: {
    'en': {
      'continue': 'Continue',
      'cancel': 'Cancel',
      'delete': 'Delete'
    },
    'de': {
      'continue': 'Weiter',
      'cancel': 'Abbrechen',
      'delete': 'Löschen'
    }
  }
})

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')