Skip to content

Commit

Permalink
chore: 배포 설정 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellol77 committed Feb 7, 2024
1 parent bcbb234 commit 82791c8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
18 changes: 9 additions & 9 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const nextConfig = {
unoptimized: true,
domains: ["hanroro-fanpage.s3.ap-northeast-2.amazonaws.com"],
},
// async rewrites() {
// return [
// {
// source: "/api/:path*",
// destination: process.env.NEXT_PUBLIC_BASE_URL + "/:path*",
// },
// ];
// },
output: "export",
async rewrites() {
return [
{
source: "/api/:path*",
destination: process.env.NEXT_PUBLIC_BASE_URL + "/:path*",
},
];
},
// output: "export",
trailingSlash: true,
reactStrictMode: false,
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"packageManager": "[email protected]",
"scripts": {
"dev": "NODE_ENV=development next dev",
"build": "next build && next export",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prepare": "cd .. && husky install frontend/.husky",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/apis/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defaultApi } from "@/apis";

export const checkAdmin = async (accessToken: string) => {
try {
const { data } = await defaultApi.get("/admin", {
const { data } = await defaultApi.get("/api/admin", {
headers: { Authorization: `Bearer ${accessToken}` },
});
return data;
Expand All @@ -22,7 +22,7 @@ export const getReportedPosts = async ({
accessToken?: string;
}) => {
const api = defaultApi
.get(`/admin/post/${pageParam}`, {
.get(`/api/admin/post/${pageParam}`, {
headers: { Authorization: `Bearer ${accessToken}` },
})
.then(async (data) => {
Expand All @@ -44,7 +44,7 @@ export const getReportedComments = async ({
accessToken?: string;
}) => {
const api = defaultApi
.get(`/admin/comment/${pageParam}`, {
.get(`/api/admin/comment/${pageParam}`, {
headers: { Authorization: `Bearer ${accessToken}` },
})
.then(async (data) => {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/apis/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ import { defaultApi } from "@/apis/index";
import { ClientData, ValidateAccessToken } from "@/types/user";

export const refreshAccessTokenApi = async <T = ClientData>(oAuthType: string): Promise<T> => {
const { data } = await defaultApi.post<T>(`/auth/${oAuthType}/refresh`);
const { data } = await defaultApi.post<T>(`/api/auth/${oAuthType}/refresh`);
return data;
};

export const logoutApi = async (accessToken: string, id: string) => {
const userData = { accessToken, id };
const api = await defaultApi.post("/auth/kakao/logout", userData, {
const api = await defaultApi.post("/api/auth/kakao/logout", userData, {
headers: { "Content-Type": "application/json" },
});
return api;
};

export const loginApi = async <T = ClientData>(search: string): Promise<T> => {
const { data } = await defaultApi.get(`/auth/kakao/login?code=${search}`);
const { data } = await defaultApi.get(`/api/auth/kakao/login?code=${search}`);
return data;
};

export const validateAccessTokenApi = async <T = ValidateAccessToken>(
accessToken: string,
): Promise<T> => {
const { data } = await defaultApi.post("/auth/kakao/validate", {
const { data } = await defaultApi.post("/api/auth/kakao/validate", {
accessToken,
});
return data;
Expand Down
26 changes: 13 additions & 13 deletions frontend/src/apis/post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getBoardPosts = async ({
accessToken?: string;
}) => {
const api = defaultApi
.get(`/post/page/${pageParam}`, {
.get(`/api/post/page/${pageParam}`, {
headers: { Authorization: `Bearer ${accessToken}` },
})
.then(async (data) => {
Expand All @@ -38,15 +38,15 @@ export const uploadBoardPost = async ({
// formData.append(key, value);
// });
// console.log(formData);
const api = await defaultApi.post("/post", data, {
const api = await defaultApi.post("/api/post", data, {
headers: { Authorization: `Bearer ${accessToken}` },
});

return api;
};

export const getRecentPosts = async <T = Post[]>(accessToken: string): Promise<T> => {
const { data } = await defaultApi.get<T>(`/post/recent`, {
const { data } = await defaultApi.get<T>(`/api/post/recent`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
try {
Expand All @@ -67,7 +67,7 @@ export const getUserPosts = async ({
userId: string;
}) => {
try {
const { data } = await defaultApi.get(`/post/user/${userId}?page=${pageParam}`, {
const { data } = await defaultApi.get(`/api/post/user/${userId}?page=${pageParam}`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return { pages: data, pageParams: pageParam + 1 };
Expand All @@ -86,7 +86,7 @@ export const getLikedPosts = async ({
accessToken?: string;
}) => {
try {
const { data } = await defaultApi.get(`/post/like?page=${pageParam}`, {
const { data } = await defaultApi.get(`/api/post/like?page=${pageParam}`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return { pages: data, pageParams: pageParam + 1 };
Expand All @@ -98,7 +98,7 @@ export const getLikedPosts = async ({

export const dislikePost = async ({ _id, accessToken }: { _id: string; accessToken: string }) => {
const api = await defaultApi
.post("/post/dislike", { _id }, { headers: { Authorization: `Bearer ${accessToken}` } })
.post("/api/post/dislike", { _id }, { headers: { Authorization: `Bearer ${accessToken}` } })
.then()
.catch((err) => {
console.log(err);
Expand All @@ -109,7 +109,7 @@ export const dislikePost = async ({ _id, accessToken }: { _id: string; accessTok

export const likePost = async ({ _id, accessToken }: { _id: string; accessToken: string }) => {
const api = await defaultApi
.post("/post/like", { _id }, { headers: { Authorization: `Bearer ${accessToken}` } })
.post("/api/post/like", { _id }, { headers: { Authorization: `Bearer ${accessToken}` } })
.then()
.catch((err) => {
console.log(err);
Expand All @@ -129,7 +129,7 @@ export const addComment = async ({
}) => {
try {
await defaultApi.post(
"/post/comment",
"/api/post/comment",
{ postId, content },
{ headers: { Authorization: `Bearer ${accessToken}` } },
);
Expand All @@ -147,7 +147,7 @@ export const deletePost = async ({
accessToken: string;
}) => {
try {
await defaultApi.delete(`/post`, {
await defaultApi.delete(`/api/post`, {
data: { postId },
headers: { Authorization: `Bearer ${accessToken}` },
});
Expand All @@ -165,7 +165,7 @@ export const deleteComment = async ({
accessToken: string;
}) => {
try {
await defaultApi.delete(`/post/comment`, {
await defaultApi.delete(`/api/post/comment`, {
data: { commentId },
headers: { Authorization: `Bearer ${accessToken}` },
});
Expand All @@ -191,7 +191,7 @@ export const editPost = async ({
// });
const newData = { ...data, postId };
try {
const api = await defaultApi.patch(`/post`, newData, {
const api = await defaultApi.patch(`/api/post`, newData, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return api;
Expand All @@ -210,7 +210,7 @@ export const reportPost = async ({
}) => {
try {
await defaultApi.post(
"/post/report",
"/api/post/report",
{ postId },
{ headers: { Authorization: `Bearer ${accessToken}` } },
);
Expand All @@ -229,7 +229,7 @@ export const reportComment = async ({
}) => {
try {
await defaultApi.post(
"/post/comment/report",
"/api/post/comment/report",
{ commentId },
{ headers: { Authorization: `Bearer ${accessToken}` } },
);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/apis/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defaultApi } from "@/apis/index";
import { UserData, UserEditProfileType } from "@/types/user";

export const getMyProfileInfo = async (accessToken: string): Promise<UserData> => {
const { data } = await defaultApi.post("/user/profile", {
const { data } = await defaultApi.post("/api/user/profile", {
accessToken: accessToken,
});
return data;
Expand All @@ -15,13 +15,13 @@ export const editProfile = async (data: UserEditProfileType) => {
formData.append(key, value);
});

const api = await defaultApi.post(`/user/profile/edit`, formData, {
const api = await defaultApi.post(`/api/user/profile/edit`, formData, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return api;
};

export const searchProfile = async (_id: string) => {
const { data } = await defaultApi.get(`/user/profile/${_id}`);
const { data } = await defaultApi.get(`/api/user/profile/${_id}`);
return data;
};

0 comments on commit 82791c8

Please sign in to comment.