forked from Chenshasan/SEexperiement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
102 lines (87 loc) · 3.5 KB
/
main.ts
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
92
93
94
95
96
97
98
99
100
101
102
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.common with an alias.
import Vue from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import App from './app.vue';
import uploader from 'vue-simple-uploader';
import Vue2Filters from 'vue2-filters';
import router from './router';
import * as config from './shared/config/config';
import * as bootstrapVueConfig from './shared/config/config-bootstrap-vue';
import JhiItemCountComponent from './shared/jhi-item-count.vue';
import JhiSortIndicatorComponent from './shared/sort/jhi-sort-indicator.vue';
import InfiniteLoading from 'vue-infinite-loading';
import AuditsService from './admin/audits/audits.service';
import HealthService from './admin/health/health.service';
import MetricsService from './admin/metrics/metrics.service';
import LogsService from './admin/logs/logs.service';
import ActivateService from './account/activate/activate.service';
import RegisterService from './account/register/register.service';
import UserManagementService from '@/admin/user-management/user-management.service';
import LoginService from './account/login.service';
import AccountService from './account/account.service';
import '../content/scss/vendor.scss';
import AlertService from '@/shared/alert/alert.service';
import TranslationService from '@/locale/translation.service';
import ConfigurationService from '@/admin/configuration/configuration.service';
import VueHighlightJS from 'vue-highlightjs';
import 'highlight.js/styles/atom-one-light.css';
/* tslint:disable */
// jhipster-needle-add-entity-service-to-main-import - JHipster will import entities services here
/* tslint:enable */
Vue.config.productionTip = false;
config.initVueApp(Vue);
config.initFortAwesome(Vue);
bootstrapVueConfig.initBootstrapVue(Vue);
Vue.use(Vue2Filters);
Vue.use(uploader);
Vue.use(VueHighlightJS);
Vue.component('font-awesome-icon', FontAwesomeIcon);
Vue.component('jhi-item-count', JhiItemCountComponent);
Vue.component('jhi-sort-indicator', JhiSortIndicatorComponent);
Vue.component('infinite-loading', InfiniteLoading);
const i18n = config.initI18N(Vue);
const store = config.initVueXStore(Vue);
const alertService = new AlertService(store);
const translationService = new TranslationService(store, i18n);
const loginService = new LoginService();
const accountService = new AccountService(store, translationService, router);
router.beforeEach((to, from, next) => {
if (!to.matched.length) {
next('/not-found');
}
if (to.meta && to.meta.authorities && to.meta.authorities.length > 0) {
if (!accountService.hasAnyAuthority(to.meta.authorities)) {
sessionStorage.setItem('requested-url', to.fullPath);
next('/forbidden');
} else {
next();
}
} else {
// no authorities, so just proceed
next();
}
});
/* tslint:disable */
new Vue({
el: '#app',
components: { App },
template: '<App/>',
router,
provide: {
loginService: () => loginService,
activateService: () => new ActivateService(),
registerService: () => new RegisterService(),
userService: () => new UserManagementService(),
auditsService: () => new AuditsService(),
healthService: () => new HealthService(),
configurationService: () => new ConfigurationService(),
logsService: () => new LogsService(),
metricsService: () => new MetricsService(),
alertService: () => alertService,
translationService: () => translationService,
accountService: () => accountService
},
i18n,
store
});