Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/app/api/auth/refresh/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const API_BASE_URL = 'https://gdgocinha.site/auth'; // 프록시 대상 주소

export async function POST(req) {
const targetUrl = `${API_BASE_URL}/refresh`;
const isProd = process.env.NODE_ENV === 'production';

try {
const cookies = req.headers.get('cookie') || '';
Expand Down Expand Up @@ -33,8 +34,8 @@ export async function POST(req) {
nextResponse.cookies.set(name, value, {
path: '/',
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'strict',
secure: isProd,
sameSite: isProd ? 'none' : 'lax',
});
});
}
Expand Down
9 changes: 5 additions & 4 deletions src/app/api/signin/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function POST(request) {
try {
// 클라이언트로부터 받은 요청 데이터 추출
const { email, password } = await request.json();
const isProd = process.env.NODE_ENV === 'production';

// gdgocinha.site/auth/login으로 요청 전달
const response = await axios.post(
Expand All @@ -30,18 +31,18 @@ export async function POST(request) {
// 원본 응답의 쿠키가 있으면 추출하여 현재 도메인에 설정
const cookies = response.headers['set-cookie'];
if (cookies) {
cookies.forEach(cookie => {
cookies.forEach((cookie) => {
// 쿠키 문자열에서 이름과 값 부분만 추출
const cookieParts = cookie.split(';')[0].split('=');
const cookieName = cookieParts[0];
const cookieValue = cookieParts.slice(1).join('=');

// 추출한 쿠키를 현재 도메인에 설정
nextResponse.cookies.set(cookieName, cookieValue, {
path: '/',
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'strict',
secure: isProd,
sameSite: isProd ? 'none' : 'lax',
});
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/study/create/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ export default function CreateStudy() {
imagePath: getS3Key
};

console.log(updateFormData);

await apiClient.post('/study', updateFormData);

alert("스터디 개설이 완료되었습니다!");
Expand Down