Skip to content

Commit 8590023

Browse files
sumisumi
authored andcommitted
feat: login redirect 경로 추가
1 parent 81d6764 commit 8590023

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

apps/web/src/app/api/oauth/route.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
import { NextResponse } from 'next/server';
22

33
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+
return 'HOME';
19+
})();
20+
421
const res = await fetch('https://api.gitanimals.org/logins/oauth/github', {
522
headers: {
6-
'Redirect-When-Success': process.env.NODE_ENV === 'production' ? 'HOME' : 'LOCAL',
23+
'Redirect-When-Success': redirectWhenSuccess,
724
},
825
});
926

0 commit comments

Comments
 (0)