11import Vue from 'vue' ;
22import Router from 'vue-router' ;
3+ < % _ if ( options . useAuthorisation ) { _ % >
4+ import AuthorisationGuard from './guards/AuthorisationGuard' ;
5+ < % _ } _ % >
36
47Vue . use ( Router ) ;
58
@@ -8,77 +11,80 @@ export default new Router({
811 base : process . env . BASE_URL ,
912 routes : [
1013 {
11- path : '/' ,
12- name : 'home' ,
13- component : ( ) => import ( '@/views/Home' ) ,
14- } ,
15- {
16- path : '/403' ,
17- name : '403' ,
18- component : ( ) => import ( './views/PageForbidden.vue' ) ,
14+ path : '' ,
15+ redirect : { name : 'home' } ,
1916 } ,
2017 < % _ if ( options . useAuthorisation ) { _ % >
2118 {
22- path : '/login' ,
23- name : 'login' ,
24- component : ( ) => import ( '@/views/Login' ) ,
25- < % _ if ( options . useTemplateLoader ) { _ % >
26- meta : {
27- template : ( ) => import ( './templates/Authorisation.vue' ) ,
28- } ,
29- < % _ } _ % >
30- } ,
31- {
32- path : '/password/forgotten' ,
33- name : 'password.forgotten' ,
34- component : ( ) => import ( './views/PasswordForgotten.vue' ) ,
35- < % _ if ( options . useTemplateLoader ) { _ % >
36- meta : {
37- template : ( ) => import ( './templates/Authorisation.vue' ) ,
38- } ,
39- < % _ } _ % >
19+ path : '' ,
20+ component : ( ) => import ( '@/templates/Authorisation' ) ,
21+ children : [
22+ {
23+ path : '/login' ,
24+ name : 'login' ,
25+ component : ( ) => import ( '@/views/Login' ) ,
26+ } ,
27+ {
28+ path : '/password/forgotten' ,
29+ name : 'password.forgotten' ,
30+ component : ( ) => import ( './views/PasswordForgotten.vue' ) ,
31+ } ,
32+ {
33+ path : '/password/reset/:token' ,
34+ name : 'password.reset' ,
35+ component : ( ) => import ( './views/PasswordReset.vue' ) ,
36+ } ,
37+ {
38+ path : '/invitation/accept/:token' ,
39+ name : 'invitation.accept' ,
40+ component : ( ) => import ( './views/InvitationAccept.vue' ) ,
41+ } ,
42+ ]
4043 } ,
44+ < % _ } _ % >
4145 {
42- path : '/password/reset/:token' ,
43- name : 'password.reset' ,
44- component : ( ) => import ( './views/PasswordReset.vue' ) ,
45- < % _ if ( options . useTemplateLoader ) { _ % >
46- meta : {
47- template : ( ) => import ( './templates/Authorisation.vue' ) ,
48- } ,
46+ path : '' ,
47+ < % _ if ( options . useAuthorisation ) { _ % >
48+ beforeEnter : AuthorisationGuard ,
4949 < % _ } _%>
50+ component : ( ) => import ( '@/templates/Default' ) ,
51+ children : [
52+ {
53+ path : '/' ,
54+ name : 'home' ,
55+ component : ( ) => import ( '@/views/Home' ) ,
56+ } ,
57+ < % _ if ( options . useAuthorisation ) { _ % >
58+ {
59+ path : '/profile' ,
60+ name : 'profile' ,
61+ component : ( ) => import ( './views/Profile.vue' )
62+ } ,
63+ < % _ } _ % >
64+ < % _ if ( options . useCrud ) { _ % >
65+ {
66+ path : '/users' ,
67+ name : 'users' ,
68+ component : ( ) => import ( './views/UserResource.vue' )
69+ } ,
70+ < % _ } _ % >
71+ {
72+ path : '/404' ,
73+ name : '404' ,
74+ component : ( ) => import ( './views/PageNotFound.vue' ) ,
75+ } ,
76+ {
77+ path : '/403' ,
78+ name : '403' ,
79+ component : ( ) => import ( './views/PageForbidden.vue' ) ,
80+ } ,
81+ {
82+ path : '*' ,
83+ redirect : '/404'
84+ } ,
85+ ] ,
5086 } ,
51- {
52- path : '/invitation/accept/:token' ,
53- name : 'invitation.accept' ,
54- component : ( ) => import ( './views/InvitationAccept.vue' ) ,
55- < % _ if ( options . useTemplateLoader ) { _ % >
56- meta : {
57- template : ( ) => import ( './templates/Authorisation.vue' ) ,
58- } ,
59- < % _ } _ % >
60- } ,
61- {
62- path : '/profile' ,
63- name : 'profile' ,
64- component : ( ) => import ( './views/Profile.vue' )
65- } ,
66- < % _ } _ % >
67- < % _ if ( options . useCrud ) { _ % >
68- {
69- path : '/users' ,
70- name : 'users' ,
71- component : ( ) => import ( './views/UserResource.vue' )
72- } ,
73- < % _ } _ % >
74- {
75- path : '/404' ,
76- name : '404' ,
77- component : ( ) => import ( './views/PageNotFound.vue' ) ,
78- } ,
79- {
80- path : '*' ,
81- redirect : '/404'
82- } ,
87+
88+
8389 ],
8490} ) ;
0 commit comments