Skip to content

Commit fef5acb

Browse files
authored
Merge pull request #195 from codeit-plake/dev
[Deploy] v1.1.12 서비스 배포
2 parents 2446026 + c7c20bf commit fef5acb

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/actions/user-check-action.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ const userCheckAction = async (token: string) => {
2121
// 유저 정보 받아와서 image null 처리
2222
const resUser: IUser = await response.json();
2323
resUser.image = resUser.image || "";
24+
2425
return {
2526
status: true,
2627
user: resUser,
2728
error: "",
29+
token: token,
2830
};
2931
} catch (err) {
3032
return {
3133
status: false,
3234
user: null,
3335
error: `${(err as Error).message}`,
36+
token: null,
3437
};
3538
}
3639
};

src/actions/user-signin-action.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,22 @@ const userSignInAction = async (_: any, formData: FormData) => {
2424
// 토큰 받아오기 실패
2525
if (!response.ok) {
2626
const errorText = await response.text();
27-
console.error("API 응답 오류:", errorText);
2827
throw new Error(errorText);
2928
}
3029

31-
// 토큰을 받아오면 쿠키에 저장
3230
const res = await response.json();
3331

3432
// 유저 정보 확인
35-
const chkResult = await userCheckAction(res.token);
36-
37-
// 유저 정보 확인 성공
38-
if (!chkResult.status) {
39-
throw new Error(chkResult.error);
40-
}
33+
const state = await userCheckAction(res.token);
4134

4235
// 성공시 유저 정보 반환
43-
return {
44-
status: true,
45-
error: "",
46-
user: chkResult.user,
47-
};
36+
return state;
4837
} catch (err) {
4938
return {
5039
status: false,
5140
error: `${(err as Error).message}`,
5241
user: null,
42+
token: null,
5343
};
5444
}
5545
};

src/app/gathering/detail/[id]/_components/GatheringDetailInformation.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ const GatheringDetailInformation = ({
3232
<div className="flex flex-col gap-3">
3333
<div className="flex flex-col gap-1">
3434
<p className="line-clamp-2 pr-3 text-lg font-semibold">{name}</p>
35-
<p className="text-sm font-medium text-gray-700">{location}</p>
35+
<p className="text-sm font-medium text-gray-700">
36+
{location === "홍대입구" ? "온라인" : location}
37+
</p>
3638
</div>
3739
<DateTimeTag date={dayjs(dateTime)} />
3840
</div>

src/app/login/_components/LoginForm.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import useFavorite from "@/hooks/useFavorite";
1818
import { useModal } from "@/hooks/useModal";
1919
import { LoginFormSchema } from "@/schemas/loginJoinSchema";
2020
import useUserStore from "@/stores/useUserStore";
21+
import { setCookieOfToken } from "@/utils/cookieToken";
2122

2223
import {
2324
IRegisterWithValidation,
@@ -68,12 +69,16 @@ const LoginForm = () => {
6869
}
6970
setIsSubmitting(false);
7071
} else if (state && state.status && state.user) {
71-
setUserState(state.user);
72-
73-
// 로그인 유저의 즐겨찾기 목록 가져오기
74-
setFavoriteInitValue(state.user?.email);
75-
76-
router.replace("/");
72+
setCookieOfToken(state.token)
73+
.then(() => {
74+
setUserState(state.user!);
75+
setFavoriteInitValue(state.user!.email);
76+
router.replace("/");
77+
})
78+
.catch(error => {
79+
setAlertMessage("쿠키 설정 오류: " + error.message);
80+
onOpen();
81+
});
7782
}
7883

7984
// eslint-disable-next-line react-hooks/exhaustive-deps

src/utils/cookieToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const setCookieOfToken = async (token: string): Promise<void> => {
88
value: token,
99
httpOnly: true,
1010
path: "/",
11-
maxAge: 60 * 60, // 1시간
11+
maxAge: 60 * 60, // 1시간.
1212
secure: process.env.NODE_ENV === "production",
1313
sameSite: "lax",
1414
});

0 commit comments

Comments
 (0)