File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { type NextRequest, NextResponse } from "next/server";
33import { postLogin } from "@/app/_api/auth/auth.api" ;
44import { TOKEN_TIMES } from "@/constants/time.constants" ;
55import { type ApiError } from "@/lib/api" ;
6+ import { UnauthorizedException } from "@/lib/exceptions" ;
67import { getSessionFromServer } from "@/lib/session" ;
78
89/**
@@ -48,10 +49,10 @@ export const POST = async (req: NextRequest) => {
4849 return NextResponse . json ( data . information ) ;
4950 } catch ( error ) {
5051 console . error ( "Login failed:" , error ) ;
51- // TODO: 에러 처리 세분화
52+
5253 return NextResponse . json < ApiError > (
53- { errorMessage : "인증에 실패했습니다." } ,
54- { status : 401 }
54+ { errorMessage : "로그인에 실패했습니다." } ,
55+ { status : error instanceof UnauthorizedException ? 401 : 400 }
5556 ) ;
5657 }
5758} ;
You can’t perform that action at this time.
0 commit comments