diff options
author | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
commit | 7bb53c64da2dcf88894bfd31503accdd81498f3d (patch) | |
tree | 4310e12366818af27947b5e2c80cb162da93a4b5 /dashboard/src/main.js | |
parent | cbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff) |
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com>
Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'dashboard/src/main.js')
-rw-r--r-- | dashboard/src/main.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/dashboard/src/main.js b/dashboard/src/main.js new file mode 100644 index 00000000..e18e3ebf --- /dev/null +++ b/dashboard/src/main.js @@ -0,0 +1,58 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import VueResource from 'vue-resource' +import VeeValidate from 'vee-validate' +import Toasted from 'vue-toasted' + +Vue.config.productionTip = false + +Vue.use(VueResource) +Vue.use(VeeValidate) +Vue.use(Toasted) + +Vue.http.interceptors.push(function () { + return function (response) { + if (response.status == 401) { + router.push('auth'); + } else if (response.status == 0) { + router.push('error'); + } + } +}); + +var authKey = localStorage.getItem("auth-key") +if (authKey) { + Vue.http.headers.common['x-api-key'] = authKey; +} else { + router.push('auth'); +} + +Vue.toasted.register('toast', + (payload) => { + return ` + <div class="toast show" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + <span class="badge badge-${payload.type}"> </span> + <strong class="ml-2">${payload.title}</strong> + </div> + <div class="toast-body"> + ${payload.message} + </div> + </div> + `; + }, + + { + className: "toast-background", + position: 'top-center', + duration: 3000 + }) + + +new Vue({ + router, + render: h => h(App) +}).$mount('#app') + + |