Skip to content

Commit

Permalink
feat: cookie 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
tjrdnjs1534 committed Aug 22, 2024
1 parent f179321 commit 2a947ae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NextResponse, NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
const accessToken = request.cookies.get('access-token')?.value;
const refreshToken = request.cookies.get('refresh-token')?.value;

const response = NextResponse.next();

if (accessToken) response.cookies.set('access-token', accessToken);
if (refreshToken) response.cookies.set('refresh-token', refreshToken);
return response;
}

0 comments on commit 2a947ae

Please sign in to comment.