This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
router.js
109 lines (106 loc) · 3.84 KB
/
router.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import Vue from 'vue';
import Router from 'vue-router';
import OkHomePage from "./pages/home/OkHomePage";
import OkMenuPage from "./pages/home/pages/menu/OkMenuPage";
import OkNotificationsPage from "./pages/home/pages/notifications/OkNotificationsPage";
import OkNowPage from "./pages/home/pages/now/OkNowPage";
import OkTimelinePage from "./pages/home/pages/timeline/OkTimelinePage";
import OkHashtagPage from "./pages/home/pages/hashtag/OkHashtagPage";
import OkPostPage from "./pages/home/pages/post/OkPostPage";
import OkUserPage from "./pages/home/pages/user/OkUserProfilePage";
import OkCommunitiesPage from "./pages/home/pages/communities/OkCommunitiesPage";
import OkAuthPage from "./pages/auth/OkAuthPage";
import OkLoginPage from "./pages/auth/pages/OkLoginPage";
import OkResetPasswordPage from "./pages/auth/pages/OkResetPasswordPage";
import OkRequestPasswordResetPage from "./pages/auth/pages/OkRequestPasswordResetPage";
import OkRegisterPage from "./pages/auth/pages/register-page/OkRegisterPage";
import OkCommunityProfile from "./pages/home/pages/community/OkCommunityProfile";
Vue.use(Router);
export function createRouter() {
return new Router({
mode: 'history',
scrollBehavior(to, from, savedPosition) {
if (to.name === 'timeline' || to.name === 'now') {
return false;
}
return {x: 0, y: savedPosition || 0}
},
routes: [
{
path: '/',
name: 'home',
component: OkHomePage,
children: [
{
name: 'timeline',
path: '',
component: OkTimelinePage,
},
{
path: 'm',
component: OkMenuPage
},
{
name: 'notifications',
path: 'n',
component: OkNotificationsPage
},
{
name: 'communities',
path: 'c',
component: OkCommunitiesPage,
},
{
path: 'c/:communityName',
component: OkCommunityProfile,
},
{
name: 'now',
path: 'now',
component: OkNowPage
},
{
path: 'h/:hashtagName',
component: OkHashtagPage,
},
{
name: 'post',
path: 'p/:postUuid',
component: OkPostPage,
},
{
name: 'user',
path: ':userUsername',
component: OkUserPage,
},
]
},
{
path: '/a',
component: OkAuthPage,
children: [
{
path: 'login',
component: OkLoginPage
},
{
path: 'reset-password',
component: OkResetPasswordPage
},
{
path: 'request-password-reset',
component: OkRequestPasswordResetPage
},
{
path: 'register',
component: OkRegisterPage
}
]
},
{
path: '/api/auth/password/verify',
redirect: '/a/reset-password'
}
]
})
}