-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·91 lines (89 loc) · 2.68 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
import VueAuth from '@websanova/vue-auth'
import NProgress from 'vue-nprogress'
import { sync } from 'vuex-router-sync'
import App from './App.vue'
import router from './router'
import store from './store'
import * as filters from './filters'
import { TOGGLE_SIDEBAR, INIT_DATA } from 'vuex-store/mutation-types'
import VuePaginate from 'vue-paginate'
Vue.use(VuePaginate)
Vue.router = router
Vue.use(VueAxios, axios)
Vue.use(VueAuth, {
auth: {
request: function (req, token) {
this.options.http._setHeaders.call(this, req, {Authorization: 'Bearer ' + token})
},
response: function (res) {
// Get Token from response body
return res.data
}
},
http: require('@websanova/vue-auth/drivers/http/axios.1.x.js'),
router: require('@websanova/vue-auth/drivers/router/vue-router.2.x.js'),
refreshData: { enabled: false }
})
Vue.use(NProgress)
// Enable devtools
Vue.config.devtools = true
sync(store, router)
const { state } = store
router.beforeEach((route, redirect, next) => {
if (state.app.device.isMobile && state.app.sidebar.opened) {
store.commit(TOGGLE_SIDEBAR, false)
}
next()
})
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
const app = new Vue({
router,
store,
created () {
this.$nextTick(function () {
// initialize store data structure by submitting action.
this.$http({
url: '/intranet/api/datafetch',
transformResponse: [(data) => {
return JSON.parse(data)
}],
params: {
parameters: {
Normalized: false,
NumberOfDays: false,
DataPeriod: false,
Elements: []
}
}
}).then((response) => {
var arrayLength = response.data.records.length
var data = []
for (var i = 0; i < arrayLength; i++) {
let obj = JSON.parse(response.data.records[i])
let dic = {}
dic.SerNr = obj.SerNr
dic.CaseTypeComment = obj.CaseTypeComment
dic.Asignee = obj.Asignee
dic.ProblemDesc = obj.ProblemDesc
dic.State = obj.State
dic.CaseComment = obj.CaseComment
dic.StatusName = obj.StatusName
dic.TransDate = obj.TransDate
dic.TransTime = obj.TransTime
dic.State = obj.State
data.push(dic)
}
store.commit(INIT_DATA, {data: data, casestypes: response.data.casetype, personname: response.data.personname, clientstate:response.data.clientstate, inews:response.data.inews})
}).catch((error) => {
this.$router.push('/login')
})
})
},
...App
})
export { app, router, store }