-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.js
70 lines (64 loc) · 2.11 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
61
62
63
64
65
66
67
68
69
70
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 FranchisesOverview from "./components/FranchisesOverview.vue";
import FranchiseDetails from "./components/FranchiseDetails.vue";
import AdminCorner from "./components/AdminCorner.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: FranchisesOverview
},
{
path: "/franchise-details",
component: FranchiseDetails
},
{
path: "/admin-corner",
component: AdminCorner
},
{
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 = "/backend/easyfranchise/rest/efservice/v1";
// Change variable to localhost if you want to test the application locally
// Vue.prototype.$backendApi = "http://localhost:8080/easyfranchise/rest/efservice/v1";
// Rendering the main vue component and adding the router to it.
new Vue({
render: h => h(App),
router
}).$mount('#app')