We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 81d6764 commit 8590023Copy full SHA for 8590023
1 file changed
apps/web/src/app/api/oauth/route.ts
@@ -1,9 +1,26 @@
1
import { NextResponse } from 'next/server';
2
3
export async function GET() {
4
+ const redirectWhenSuccess = (() => {
5
+ const NEXT_PUBLIC_ENV_MODE = process.env.NEXT_PUBLIC_ENV_MODE;
6
+
7
+ if (NEXT_PUBLIC_ENV_MODE === 'prod') {
8
+ return 'HOME';
9
+ }
10
+ if (NEXT_PUBLIC_ENV_MODE === 'dev') {
11
+ return 'DEV';
12
13
14
+ if (process.env.NODE_ENV === 'development') {
15
+ return 'LOCAL';
16
17
18
19
+ })();
20
21
const res = await fetch('https://api.gitanimals.org/logins/oauth/github', {
22
headers: {
- 'Redirect-When-Success': process.env.NODE_ENV === 'production' ? 'HOME' : 'LOCAL',
23
+ 'Redirect-When-Success': redirectWhenSuccess,
24
},
25
});
26
0 commit comments