diff --git a/src/actions/user-check-action.ts b/src/actions/user-check-action.ts
index 47e749a..fbadd99 100644
--- a/src/actions/user-check-action.ts
+++ b/src/actions/user-check-action.ts
@@ -1,31 +1,26 @@
"use server";
import { IUser } from "@/types/user";
-import { getCookieOfToken } from "@/utils/cookieToken";
-
-const userCheckAction = async () => {
- const TOKEN = await getCookieOfToken();
+const userCheckAction = async (token: string) => {
try {
const response = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/auths/user`,
{
method: "GET",
headers: {
- Authorization: `Bearer ${TOKEN}`,
+ Authorization: `Bearer ${token}`,
},
},
);
- // 유저 정보 확인 실패
if (!response.ok) {
throw new Error(await response.text());
}
- // 유저 정보 확인 성공 시 image null 처리
+ // 유저 정보 받아와서 image null 처리
const resUser: IUser = await response.json();
resUser.image = resUser.image || "";
-
return {
status: true,
user: resUser,
diff --git a/src/actions/user-signin-action.ts b/src/actions/user-signin-action.ts
index 516a7a9..01fcb76 100644
--- a/src/actions/user-signin-action.ts
+++ b/src/actions/user-signin-action.ts
@@ -1,7 +1,5 @@
"use server";
-import { setCookieOfToken } from "@/utils/cookieToken";
-
import userCheckAction from "./user-check-action";
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
@@ -23,24 +21,25 @@ const userSignInAction = async (_: any, formData: FormData) => {
},
);
- // 로그인 실패
+ // 토큰 받아오기 실패
if (!response.ok) {
- throw new Error(await response.text());
+ const errorText = await response.text();
+ console.error("API 응답 오류:", errorText);
+ throw new Error(errorText);
}
// 토큰을 받아오면 쿠키에 저장
const res = await response.json();
- await setCookieOfToken(res.token);
- // 로그인 성공 시 유저 정보 확인
- const chkResult = await userCheckAction();
+ // 유저 정보 확인
+ const chkResult = await userCheckAction(res.token);
- // 유저 정보 확인 실패
+ // 유저 정보 확인 성공
if (!chkResult.status) {
throw new Error(chkResult.error);
}
- // 유저 정보 반환
+ // 성공시 유저 정보 반환
return {
status: true,
error: "",
diff --git a/src/actions/user-signup-action.ts b/src/actions/user-signup-action.ts
index 3e79c3a..8ba92f2 100644
--- a/src/actions/user-signup-action.ts
+++ b/src/actions/user-signup-action.ts
@@ -21,12 +21,10 @@ const userSignUpAction = async (_: any, formData: FormData) => {
},
);
- // 회원가입 실패
if (!response.ok) {
throw new Error(await response.text());
}
- // 회원가입 성공
return {
status: true,
error: "",
diff --git a/src/app/all-reviews/[tab]/_components/ReviewListParent.tsx b/src/app/all-reviews/[tab]/_components/ReviewListParent.tsx
index 6d62969..08e334e 100644
--- a/src/app/all-reviews/[tab]/_components/ReviewListParent.tsx
+++ b/src/app/all-reviews/[tab]/_components/ReviewListParent.tsx
@@ -54,7 +54,7 @@ const ReviewListParent = () => {