260115_02_ENH : 로그인 오류 수정 및 템플릿 생성 연동 완료

This commit is contained in:
2026-01-15 11:36:01 +09:00
parent 7e7b494389
commit 431513c195
34 changed files with 823 additions and 103 deletions

View File

@@ -32,12 +32,12 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
return NextResponse.json(result, { status: 200 });
}
if(action === "result-code" && slug.length === 2){
const result = await contactApi.get<ResultCode[]>(`/result-code/${slug[1]}`);
return NextResponse.json(result, { status: 200 });
if(action === "main-template" && slug.length === 3){
const result = await contactApi.get<number | null | "">(`/project/main-template/${slug[1]}/${slug[2]}`);
const returValue = result === null || result === "" ? null : Number(result);
return NextResponse.json(returValue, { status: 200 });
}
return NextResponse.json({ message: "Not found" }, { status: 404 });
} catch (error: unknown) {
return errorToResponse(error);
@@ -133,6 +133,20 @@ export const PATCH = async (req: NextRequest, context: RouteContext) => {
const [action] = slug;
const contactApi = await createContactApi();
if(action === "main-template"){
const body = await req.json().catch(() => null);
if (!body) {
return NextResponse.json(
{ message: "요청 바디가 없습니다." },
{ status: 400 }
);
}
await contactApi.patch(`/project/main-template`, body);
return new NextResponse(null, { status: 204 });
}
if(slug.length === 1){
const body = await req.json().catch(() => null);