-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
76 lines (70 loc) · 1.59 KB
/
routes.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
const HOME = "/";
// Videos
const SEARCH = "/search";
const VIDEO = "/video/:id";
const EDIT_VIDEO = "/video/:id/edit";
const DELETE_VIDEO = "/video/:id/delete";
const UPLOAD = "/upload";
const REGISTER_VIEW = "/api/video/:id/view";
// Users
const LOGIN = "/login";
const JOIN = "/join";
const USER = "/user/:id";
const ME = "/me";
const EDIT_PROFILE = "/me/edit";
const UPDATE_PASSWORD = "/me/edit/password";
const LOG_OUT = "/logout";
const FACEBOOK_LOGIN = "/auth/facebook";
const FACEBOOK_CALLBACK = "/auth/facebook/callback";
const GITHUB_LOGIN = "/auth/github";
const GITHUB_CALLBACK = "/auth/github/callback";
// Comments
const POST_COMMENT = "/api/video/:id/comment";
const DELETE_COMMENT = "/api/comment/:id/delete";
const routes = {
postComment: POST_COMMENT,
deleteComment: DELETE_COMMENT,
home: HOME,
search: SEARCH,
editVideo: id => {
if (id) {
return `/video/${id}/edit`;
} else {
return EDIT_VIDEO;
}
},
deleteVideo: id => {
if (id) {
return `/video/${id}/delete`;
} else {
return DELETE_VIDEO;
}
},
upload: UPLOAD,
login: LOGIN,
join: JOIN,
user: id => {
if (id) {
return `/user/${id}`;
} else {
return USER;
}
},
me: ME,
editProfile: EDIT_PROFILE,
updatePassword: UPDATE_PASSWORD,
videoDetail: id => {
if (id) {
return `/video/${id}`;
} else {
return VIDEO;
}
},
logout: LOG_OUT,
facebookLogin: FACEBOOK_LOGIN,
facebookCallback: FACEBOOK_CALLBACK,
githubLogin: GITHUB_LOGIN,
githubCallback: GITHUB_CALLBACK,
registerView: REGISTER_VIEW
};
export default routes;