Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/actions/user-check-action.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
17 changes: 8 additions & 9 deletions src/actions/user-signin-action.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: "",
Expand Down
2 changes: 0 additions & 2 deletions src/actions/user-signup-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ const userSignUpAction = async (_: any, formData: FormData) => {
},
);

// 회원가입 실패
if (!response.ok) {
throw new Error(await response.text());
}

// 회원가입 성공
return {
status: true,
error: "",
Expand Down
2 changes: 1 addition & 1 deletion src/app/all-reviews/[tab]/_components/ReviewListParent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ReviewListParent = () => {
<ReviewCardList reviews={flatData} />
<div ref={setTarget} className="h-10 w-full">
{isFetchingNextPage && (
<div className="flex justify-center p-4">
<div className="flex justify-center py-8">
<LoadingSpinner size="lg" />
</div>
)}
Expand Down
10 changes: 10 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<head>
<link
rel="preconnect"
href="https://fe-adv-project-together-dallaem.vercel.app"
/>
<link
rel="preconnect"
href="https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/together-dallaem"
/>
</head>
<body className={`${FONT.variable} antialiased`} suppressHydrationWarning>
<QueryProvider>
<Header />
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/ReviewCardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ReviewCardItem = memo(({ review }: TReviewCardItemProps) => {
href={`/gathering/detail/${Gathering.id}`}
style={{ display: "contents" }}
>
<div className="relative min-h-[156px] w-full max-w-[280px] overflow-hidden rounded-3xl">
<div className="relative min-h-[156px] w-full overflow-hidden rounded-3xl md:max-w-[280px]">
<Image
src={Gathering.image ?? "https://picsum.photos/500/700"}
alt={Gathering.name}
Expand Down