Skip to content

Commit

Permalink
πŸ› fix: update qa bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubumjang committed Oct 18, 2024
1 parent 270451c commit 6bb0a9c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import { ChipStatus } from "@/shared/ui/Chip/Chip";
import { LoginUserInfo } from "@/entities/user/model/user";
import Map from "@/features/map/ui/Map/Map";
import MapSkeleton from "@/features/map/ui/MapSkeleton/MapSkeleton";
import { deleteCookie } from "cookies-next";
import { useCarouselApi } from "@/shared/lib/useCarouselApi";
import { useGeoLocation } from "@/shared/lib/useGeolocation";
import useGetLoginUserInfo from "@/entities/user/api/useGetLoginUserInfo";
import useHomeLectureList from "@/entities/lecture/api/useHomeLectureList";
import useLocationLectureList from "@/entities/lecture/api/useLocationLectureList";
import useLoginedUserStore from "@/shared/store/user";
import { useQueryClient } from "@tanstack/react-query";
import { useRouter } from "next/navigation";

const Home = () => {
Expand Down Expand Up @@ -79,6 +82,10 @@ const Home = () => {
const { loginedUser: loginedUserState, setLoginedUser: setLoginedUserStore } =
useLoginedUserStore();

const queryClient = useQueryClient();
const { data: loginUserData, isSuccess: isLoginUserSuccess } =
useGetLoginUserInfo();

const {
data: locationLectureListData,
isLoading: isLocationLectureListLoading,
Expand All @@ -91,6 +98,8 @@ const Home = () => {
data: homeLectureList,
isLoading,
isSuccess,
isError,
error,
refetch,
} = useHomeLectureList({
page: lectureSize.page,
Expand All @@ -101,6 +110,15 @@ const Home = () => {

const router = useRouter();

const { setLoginedUser } = useLoginedUserStore();

// FIXME: μœ μ € 정보 μ—…λ°μ΄νŠΈλ₯Ό μ—¬κΈ°μ„œ ν•˜λŠ”κ²Œ λ§žλŠ”μ§€..
useEffect(() => {
if (isLoginUserSuccess) {
setLoginedUser(loginUserData.data.data);
}
}, []);

useEffect(() => {
if (
geolocation.curLocation &&
Expand Down Expand Up @@ -148,13 +166,22 @@ const Home = () => {
setPickLectureListData(pickLectureListData);
setMarkerLectureListData(markerLectureListData);
}
if (isError) {
// TODO: μž„μ‹œ 방편 μΏ ν‚€ 만료 됐을 λ•Œ μœ νš¨ν•œμ§€ 체크 ν›„ μž¬λ°œκΈ‰ ν•΄μ£ΌλŠ” API ν•„μš”
if (error.message === "Request failed with status code 401") {
deleteCookie("accessToken");
deleteCookie("refreshToken");
queryClient.clear();
}
}
}, [
user,
homeLectureList,
homeLectureList?.data.data,
homeLectureList?.data.markerClasses,
homeLectureList?.data.pickClasses,
isSuccess,
isError,
]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/Header/HeaderFeatures/HeaderFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const HeaderFeatures = () => {
) {
return (
<div>
<Link href={`/user/${loginedUser.nickname}`}>
<Link href={`/user/${loginedUserInfo.nickname}`}>
<div className="flex flex-col items-center justify-center desktop:w-[36px] tablet:w-[36px] mobile:w-[36px] desktop:h-[43px] tablet:h-[43px] mobile:h-[25px]">
<div className="flex items-center justify-center desktop:w-[36px] tablet:w-[36px] mobile:w-[24px] desktop:h-[25px] tablet:h-[25px] mobile:h-[24px]">
<Image
Expand Down

0 comments on commit 6bb0a9c

Please sign in to comment.