forked from javayhu/free-directory-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.ts
50 lines (43 loc) · 1.4 KB
/
routes.ts
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
// https://javascript.plainenglish.io/complete-authentication-guide-using-next-auth-v5-in-next-js-14-70e7630ab1c2
/**
* An array of routes that are accessible to the public
* These routes do not require authentication
* @type {string[]}
*/
export const publicRoutes = [
"/",
"/group",
"/product",
"/apptype",
"/app",
"/guides",
"/about",
"/about-zh",
"/terms",
"/privacy",
];
export const restrictedRoutes = [
"/docs",
"/blog",
"/saas",
];
/**
* An array of routes that are used for authentication
* These routes will redirect logged in users to /settings
* @type {string[]}
*/
export const authRoutes = [
];
/**
* The prefix for API authentication routes
* Routes that start with this prefix are used for API authentication purposes
* @type {string}
*/
export const apiAuthPrefix = "/api/auth";
// https://javascript.plainenglish.io/complete-authentication-guide-using-next-auth-v5-in-next-js-14-70e7630ab1c2
// The last thing to complete our Credentials Authentication is to set up redirect urls,
// these will be triggered in middleware.js based on the type of route and if the user session exists or not.
// When user is not logged in and tries to access protected routes redirect to login page
export const DEFAULT_REDIRECT_LOGIN_URL = '/login';
// When user is logged in and tries to access login page redirect to dashboard
export const DEFAULT_REDIRECT_HOME_URL = '/dashboard';