-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.js
60 lines (54 loc) · 1.79 KB
/
main.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
import Vue from 'vue';
// Activating vue extension for chrome in production mode
// This code should be right after importing the vue component to work properly
// See https://stackoverflow.com/questions/43781351/vue-js-is-detected-on-this-page-devtools-inspection-is-not-available-because-it
//Vue.config.devtools = true
import App from './App.vue';
import "bootstrap";
import "bootstrap/dist/css/bootstrap.css";
import FundamentalVue from 'fundamental-vue';
import VueRouter from "vue-router";
import moment from 'moment';
import MeteringDashboard from "./components/MeteringDashboard.vue";
import InfoPage from "./components/InfoPage.vue";
import UserProfile from "./components/UserProfile.vue";
Vue.use(FundamentalVue);
Vue.config.productionTip = false;
Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push
// Rewrite the push method on the prototype and handle the error message uniformly
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
// Adding the different pages to the router
const router = new VueRouter({
routes: [
{
path: "*",
component: MeteringDashboard
},
{
path: "/info-page",
component: InfoPage
},
{
path: "/user-profile",
component: UserProfile
}
]
});
// Filter to format date in the app
Vue.filter('formatDate', function(value) {
if (value) {
return moment(String(value)).format('MM/DD/YYYY')
}
})
// Defining the url path of the backend apis
Vue.prototype.$backendApi = "/day2-service/user";
// Change variable to localhost if you want to test the application locally
// Vue.prototype.$backendApi = "http://localhost:8091/user";
// Rendering the main vue component and adding the router to it.
new Vue({
render: h => h(App),
router
}).$mount('#app')