Skip to content

Commit

Permalink
Minor : 포트명 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
jobkaeHenry committed Nov 26, 2023
1 parent 82f3067 commit 5bd0761
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ARG PORT=3000
ARG NEXT_PUBLIC_CLIENT_BASE_URL

ENV NEXT_PUBLIC_BASE_URL ${NEXT_PUBLIC_BASE_URL}
ENV NEXT_PUBLIC_CLIENT_BASE_URL ${NEXT_PUBLIC_CLIENT_BASE_URL}:${PORT}
ENV NEXT_PUBLIC_CLIENT_BASE_URL ${NEXT_PUBLIC_CLIENT_BASE_URL}

RUN yarn build

Expand Down
22 changes: 19 additions & 3 deletions client/src/app/api/auth/login/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LOGIN_API_PATH } from "@/const/serverPath";
import { setCookie } from "@/hooks/useSetCookie";
import axios from "@/libs/axios";
import { SigninResponseInterface } from "@/types/auth/signinResponse";
import { AxiosResponse, isAxiosError } from "axios";
import { isAxiosError } from "axios";
import { NextRequest, NextResponse } from "next/server";

export async function POST(request: NextRequest) {
Expand All @@ -13,7 +13,16 @@ export async function POST(request: NextRequest) {
password,
});
setCookie({ key: "accessToken", value: data.token, httpOnly: true });
return NextResponse.json({ ...data });
return NextResponse.json(
{ ...data },
{
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
},
}
);
} catch (error) {
if (
isAxiosError<{
Expand All @@ -26,7 +35,14 @@ export async function POST(request: NextRequest) {
const { httpStatus, errorMessage, detailMessage } = error.response?.data;
return NextResponse.json(
{ errorMessage, detailMessage, httpStatus },
{ status: httpStatus }
{
status: httpStatus,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
},
}
);
}
}
Expand Down

0 comments on commit 5bd0761

Please sign in to comment.