routes.js
1.5 KB
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
// Global
const HOME = "/";
const JOIN = "/join";
const LOGIN = "/login";
const LOGOUT = "/logout";
const SEARCH = "/search";
// Users
const USERS = "/users";
const USER_DETAIL = "/:id";
const EDIT_PROFILE = "/edit-profile";
const CHANGE_PASSWORD = "/change-password";
const ME = "/me";
// Videos
const VIDEOS = "/videos";
const UPLOAD = "/upload";
const VIDEO_DETAIL = "/:id";
const EDIT_VIDEO = "/:id/edit";
const DELETE_VIDEO = "/:id/delete";
// Github
const GITHUB = "/auth/github";
const GITHUB_CALLBACK = "/auth/github/callback";
// Facebook
const FB = "/auth/facebook";
const FB_CALLBACK = "/auth/facebook/callback";
const routes = {
home: HOME,
join: JOIN,
login: LOGIN,
logout: LOGOUT,
search: SEARCH,
users: USERS,
userDetail: (id) => {
if (id) {
return `/users/${id}`;
} else {
return USER_DETAIL;
}
},
editProfile: EDIT_PROFILE,
changePassword: CHANGE_PASSWORD,
videos: VIDEOS,
upload: UPLOAD,
videoDetail: (id) => {
if (id) {
return `/videos/${id}`;
} else {
return VIDEO_DETAIL;
}
},
editVideo: (id) => {
if (id) {
return `/videos/${id}/edit`;
} else {
return EDIT_VIDEO;
}
},
deleteVideo: (id) => {
if (id) {
return `/videos/${id}/delete`;
} else {
return DELETE_VIDEO;
}
},
gitHub: GITHUB,
githubCallback: GITHUB_CALLBACK,
me: ME,
facebook: FB,
facebookCallback: FB_CALLBACK,
};
// template에서 직접 접근이 필요한 경우 함수로 바꿔준다.
export default routes;