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
Binary file removed public/images/1.jpeg
Binary file not shown.
Binary file removed public/images/2.jpeg
Binary file not shown.
Binary file removed public/images/kakao_login_large_wide.png
Binary file not shown.
Binary file removed public/images/sample1.jpeg
Binary file not shown.
Binary file removed public/images/sample2.jpeg
Binary file not shown.
Binary file removed public/images/sample3.jpeg
Binary file not shown.
Binary file removed public/images/sample4.jpeg
Binary file not shown.
3 changes: 3 additions & 0 deletions public/svgs/myPage/backIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/svgs/myPage/cheer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/svgs/myPage/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions public/svgs/myPage/noResult.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions public/svgs/myPage/review.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/apis/myPage/getDetail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import api from "@/apis/instance/api";

export const getReviews = async () => {
const res = await api.get("/reviews/get-all-member-reviews");
return res.data;
};

export const getCheers = async () => {
const res = await api.get("/story/member-likes");
return res.data;
};
Comment on lines +1 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

API 요청 함수의 오류 처리 개선이 필요합니다.

API 호출 시 오류 처리 로직이 없습니다. API 요청 중 발생할 수 있는 네트워크 오류나 서버 오류에 대한 처리가 필요합니다.

다음과 같이 try-catch 구문을 추가하여 개선할 수 있습니다:

export const getReviews = async () => {
+  try {
    const res = await api.get("/reviews/get-all-member-reviews");
    return res.data;
+  } catch (error) {
+    console.error("리뷰 데이터 가져오기 실패:", error);
+    throw error;
+  }
};

export const getCheers = async () => {
+  try {
    const res = await api.get("/story/member-likes");
    return res.data;
+  } catch (error) {
+    console.error("응원 데이터 가져오기 실패:", error);
+    throw error;
+  }
};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import api from "@/apis/instance/api";
export const getReviews = async () => {
const res = await api.get("/reviews/get-all-member-reviews");
return res.data;
};
export const getCheers = async () => {
const res = await api.get("/story/member-likes");
return res.data;
};
import api from "@/apis/instance/api";
export const getReviews = async () => {
try {
const res = await api.get("/reviews/get-all-member-reviews");
return res.data;
} catch (error) {
console.error("리뷰 데이터 가져오기 실패:", error);
throw error;
}
};
export const getCheers = async () => {
try {
const res = await api.get("/story/member-likes");
return res.data;
} catch (error) {
console.error("응원 데이터 가져오기 실패:", error);
throw error;
}
};
🤖 Prompt for AI Agents
In src/apis/myPage/getDetail.js lines 1 to 11, the API request functions
getReviews and getCheers lack error handling, which can cause unhandled
exceptions during network or server errors. Wrap the API calls inside try-catch
blocks to catch any errors, and handle or rethrow them appropriately to ensure
the calling code can manage failures gracefully.

11 changes: 11 additions & 0 deletions src/apis/myPage/queries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from "@tanstack/react-query";
import { getReviews } from "@/apis/myPage/getDetail";
import { getCheers } from "@/apis/myPage/getDetail";

export const useGetReviews = () => {
return useQuery({ queryKey: ["userReview"], queryFn: () => getReviews() });
};

export const useGetCheers = () => {
return useQuery({ queryKey: ["userCheers"], queryFn: () => getCheers() });
};
Comment on lines +5 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

React Query 훅 개선 필요

React Query 훅 구현이 기본적인 형태로 되어 있어, 추가적인 옵션 설정이 필요합니다.

다음과 같이 staleTime, cacheTime, 에러 처리 등 개선된 옵션을 추가하는 것이 좋습니다:

export const useGetReviews = () => {
-  return useQuery({ queryKey: ["userReview"], queryFn: () => getReviews() });
+  return useQuery({ 
+    queryKey: ["userReview"], 
+    queryFn: getReviews,
+    staleTime: 5 * 60 * 1000, // 5분
+    cacheTime: 10 * 60 * 1000, // 10분
+    retry: 1,
+    onError: (error) => {
+      console.error("리뷰 데이터 가져오기 실패:", error);
+    }
+  });
};

export const useGetCheers = () => {
-  return useQuery({ queryKey: ["userCheers"], queryFn: () => getCheers() });
+  return useQuery({ 
+    queryKey: ["userCheers"], 
+    queryFn: getCheers,
+    staleTime: 5 * 60 * 1000, // 5분
+    cacheTime: 10 * 60 * 1000, // 10분
+    retry: 1,
+    onError: (error) => {
+      console.error("응원 데이터 가져오기 실패:", error);
+    }
+  });
};

이렇게 변경하면 다음과 같은 이점이 있습니다:

  • staleTime 설정으로 불필요한 refetch 방지
  • 에러 처리 로직 개선
  • 함수 호출 방식 단순화 (화살표 함수 제거)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const useGetReviews = () => {
return useQuery({ queryKey: ["userReview"], queryFn: () => getReviews() });
};
export const useGetCheers = () => {
return useQuery({ queryKey: ["userCheers"], queryFn: () => getCheers() });
};
export const useGetReviews = () => {
return useQuery({
queryKey: ["userReview"],
queryFn: getReviews,
staleTime: 5 * 60 * 1000, // 5분
cacheTime: 10 * 60 * 1000, // 10분
retry: 1,
onError: (error) => {
console.error("리뷰 데이터 가져오기 실패:", error);
}
});
};
export const useGetCheers = () => {
return useQuery({
queryKey: ["userCheers"],
queryFn: getCheers,
staleTime: 5 * 60 * 1000, // 5분
cacheTime: 10 * 60 * 1000, // 10분
retry: 1,
onError: (error) => {
console.error("응원 데이터 가져오기 실패:", error);
}
});
};
🤖 Prompt for AI Agents
In src/apis/myPage/queries.js around lines 5 to 11, the React Query hooks
useGetReviews and useGetCheers are implemented in a basic form without
additional options. Improve these hooks by adding options such as staleTime and
cacheTime to control data freshness and caching, include error handling logic to
manage query failures gracefully, and simplify the queryFn by passing the
function reference directly instead of wrapping it in an arrow function. This
will optimize performance and enhance error management.

18 changes: 0 additions & 18 deletions src/apis/review/getPresignedUrl.js

This file was deleted.

15 changes: 0 additions & 15 deletions src/apis/review/likeToggle.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/apis/review/postImageKey.js

This file was deleted.

1 change: 0 additions & 1 deletion src/apis/review/postRecipt.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import api from "@/apis/instance/api";

export const postRecipt = async (formData) => {
// axios에 formData를 던지면, multipart/form-data; boundary=... 를 자동으로 붙여줍니다.
const res = await api.post("/naver/receipt", formData);
return res.data;
};
6 changes: 3 additions & 3 deletions src/apis/review/postReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ export const postReview = async (reviewInfo, companyId, text) => {
try {
const res = await api.post("/reviews/write", {
paymentInfoConfirmNum: reviewInfo.paymentInfoConfirmNum,
paymentInfoTime: reviewInfo.paymentInfoTime, // "2025-04-22T10:00:00"
companyId: companyId, // { companyId: 1 }
paymentInfoTime: reviewInfo.paymentInfoTime,
companyId: companyId,
review: text,
temperature: reviewInfo.temperature,
reviewCategories: reviewInfo.reviewCategory,
});
return res.data;
} catch (error) {
console.error("[postReview] 리뷰 등록 실패:", error);
// 선택적으로 사용자에게 에러 메시지를 보여주거나 오류 객체 반환 가능

throw error;
}
};
15 changes: 0 additions & 15 deletions src/apis/review/uploadImageToS3.js

This file was deleted.

1 change: 0 additions & 1 deletion src/components/common/HaveToLoginModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const HaveToLoginModal = ({
{showClose && (
<button
className="absolute top-2 right-2 p-1 text-gray-500"
// close icon removed when showClose is false
onClick={onClose}
>
<img src="/svgs/review/xIcon.svg" className="w-5 h-5" alt="닫기" />
Expand Down
4 changes: 1 addition & 3 deletions src/components/layout/BottomTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import useUIStore from "@/store/uiStore";

const BottomTab = () => {
const navigate = useNavigate();
const location = useLocation(); // ✅ 현재 URL 경로 가져오기
const location = useLocation();
const { turnOnCamera, isBottomSheetOpen, isWriteReview, isStoryDetail } =
useUIStore();

// BottomSheet 확장 or 카메라 켜짐 상태면 숨김
if (isBottomSheetOpen || turnOnCamera || isWriteReview || isStoryDetail)
return null;

Expand Down Expand Up @@ -51,7 +50,6 @@ const BottomTab = () => {
onClick={tab.onClick}
className="flex flex-col flex-1 sm:w-20 h-12 justify-center items-center gap-1 cursor-pointer"
>
{/* ✅ 현재 경로와 tab.path가 같으면 selectedIcon, 아니면 기본 icon */}
<img
src={location.pathname === tab.path ? tab.selectedIcon : tab.icon}
alt={tab.label}
Expand Down
8 changes: 8 additions & 0 deletions src/components/layout/LayoutWithTab.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { Outlet } from "react-router-dom";
import BottomTab from "@/components/layout/BottomTab";
import { useLocation } from "react-router-dom";
import { useEffect } from "react";

const LayoutWithTab = () => {
const location = useLocation();

useEffect(() => {
sessionStorage.setItem("prevPath", location.pathname);
}, [location.pathname]);

return (
<>
<Outlet />
Expand Down
21 changes: 0 additions & 21 deletions src/constants/iconMap.js

This file was deleted.

121 changes: 0 additions & 121 deletions src/constants/map/socialEnterprise.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/error/ErrorPage.jsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/pages/map/components/picker/DatePickerSheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ const DatePickerSheet = ({ onClose, onConfirm, initialMonth, initialDay }) => {

return (
<div className="fixed inset-0 z-[99999] bg-black bg-opacity-40 flex justify-center items-end">
{/* 바깥 클릭 시 닫힘 */}
<div className="absolute inset-0" onClick={onClose} />

{/* ✅ motion.div를 시트 전체에 적용 */}
<motion.div
initial={{ y: "100%" }}
animate={{ y: 0 }}
Expand All @@ -31,7 +29,6 @@ const DatePickerSheet = ({ onClose, onConfirm, initialMonth, initialDay }) => {
</button>
</div>

{/* ✅ Picker 가운데 정렬 */}
<div className="flex justify-center gap-4 mb-6">
<Picker list={months} onSelectedChange={setSelectedMonth} />
<Picker list={days} onSelectedChange={setSelectedDay} />
Expand Down
Loading