-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.js
51 lines (38 loc) · 1.22 KB
/
constants.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
export const HTTP_CODE_INVALID_USER_ACCOUNT = "INVALID_USER_ACCOUNT";
export const HTTP_CODE_USER_BLACKLISTED = "USER_BLACKLISTED";
export const HTTP_CODE_DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND";
export const isProdMode = process.env.NODE_ENV === "production";
export const HTTP_MSG_INVALID_ACC_CRED = "Account credentials is invalid!";
export const HTTP_MSG_USER_EXISTS =
"A user with the specified username or email exists!";
export const HTTP_MSG_RESET_DEMO_ACC =
"Sorry, you can't reset the password of a demo account.";
export const INVALID_DEMO_DOC_CREATION = "INVALID_DEMO_DOC_CREATION";
export const CLIENT_ORIGIN = isProdMode
? "https://soshare.onrender.com"
: "http://localhost:3000";
export const SERVER_ORIGIN = isProdMode
? "https://soshare.onrender.com"
: "http://localhost:8800";
export const COOKIE_KEY_ACCESS_TOKEN = "access_token";
export const COOKIE_KEY_REFRESH_TOKEN = "refresh_token";
export const SESSION_COOKIE_DURATION = {
shortLived: {
duration: 5,
type: "m"
},
accessToken: {
duration: 1,
type: "h"
},
refreshToken: {
extend: 28,
duration: 1,
type: "d"
}
};
export const cookieConfig = {
httpOnly: true,
sameSite: "Strict",
secure: isProdMode
};