Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

공통, 쿼리 커스텀 훅 작성 및 기타 수정 #85

Merged
merged 46 commits into from
Nov 13, 2024
Merged

Conversation

1119wj
Copy link
Collaborator

@1119wj 1119wj commented Nov 9, 2024

📄 Summary

  • 공통, 쿼리 커스텀 훅 작성 및 기타 수정

🙋🏻 More

아직 이슈 관련해서 완료된 것은 없어서 열어만 두겠습니다.

🕰️ Actual Time of Completion

8H

close #27
closes #18 #97

@1119wj 1119wj added FE 프론트엔드 관련 이슈입니다 🌱 기능추가 새로운 기능 요청입니다 ⚙️ 리팩터링 코드 퀄리티를 높입니다 labels Nov 9, 2024
@1119wj 1119wj added this to the week2 milestone Nov 9, 2024
@1119wj 1119wj self-assigned this Nov 9, 2024
@koomchang koomchang marked this pull request as draft November 9, 2024 15:05
@Miensoap Miensoap modified the milestones: week2, week3 Nov 11, 2024
@1119wj 1119wj marked this pull request as ready for review November 12, 2024 13:55
@1119wj 1119wj linked an issue Nov 12, 2024 that may be closed by this pull request
Copy link
Collaborator

@Miensoap Miensoap left a comment

Choose a reason for hiding this comment

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

https://preview.dailyroad.site/map
스크린샷 2024-11-13 113322

api 경로가 좀 이상해요
env 파일 시크릿 확인해 주세요!

<Route path="/create" element={<MapPage />} />
<Route path="/create/map" element={<MapCreateMapPage />} />
<Route path="/create/course" element={<MapCreateCoursePage />} />
<Route path="/create/map/:mapId" element={<PlaceCreatePage />} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

q. 본인 소유의 지도가 아닌데 이 경로로 접근하면 어떻게 되나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

크흠 아직 그부분의 로직이 없습니다.. 그냥 주소창에 mapId를 적어도 누구나 접근이 가능합니다.

className="w-full rounded border px-3 py-2"
required
onChange={(prev) => updateMapInfo('title', prev)}
placeholder={'새 지도명을 입력해주세요.'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3. 여긴 모드에 따라 안변하나요? 지도 or 코스로

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

생성폼과 거의 유사해서 이후에 수정폼을 만들 때 더 다듬어 봐야겠어요.

<Box>
<button
className={`h-14 w-full rounded-md ${activePlace ? 'bg-c_bg_blue' : 'bg-c_button_gray'} p-4 text-xl font-semibold text-white`}
disabled={!!!activePlace}
Copy link
Collaborator

Choose a reason for hiding this comment

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

q. 3개로 작성하신 이유가 있나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

3개가 어떤 걸 말씀하시는거죠..?

Copy link
Collaborator

Choose a reason for hiding this comment

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

!!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

와 그러네요? ?? 이거랑 헷갈렸네요
null 이면 true로 바꿔주고 싶었는데.. 수정하겠습니다

Copy link
Collaborator

@koomchang koomchang left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

return data;
};

export const getCourseList = async () => {
const { data } = await axiosInstance.get<MapListResponse>(END_POINTS.COURSES);
const { data } = await axiosInstance.get<MapList>(END_POINTS.COURSES);
Copy link
Collaborator

Choose a reason for hiding this comment

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

p1: MapList가 아니라 CourseList가 들어가야 될 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵넵 수정하겠습니다..

Comment on lines +24 to +28
if (mode === 'MAP') {
return navigate('/create/map');
} else {
return navigate('/create/course');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

p2: else를 없앨 수 있을 것 같네요

Suggested change
if (mode === 'MAP') {
return navigate('/create/map');
} else {
return navigate('/create/course');
}
if (mode === 'MAP') {
return navigate('/create/map');
}
return navigate('/create/course');

const { data: mapListData } = useQuery<MapList, Error>({
queryKey: ['mapList'],
queryFn: () => getMapList(),
staleTime: 1000 * 60 * 5,
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: staleTime은 어떤 시간인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

캐시 데이터가 신선함을 나타내는 시간입니다.
5분이 지나면 같은 queryKey에 대해 새롭게 api 요청을 보내게 되고
그 전에는 캐시된 데이터를 사용합니다.

@1119wj 1119wj merged commit 97e9ea9 into develop Nov 13, 2024
2 checks passed
Copy link
Collaborator

@hyohyo12 hyohyo12 left a comment

Choose a reason for hiding this comment

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

수고 많았습니다!!!

query: query,
queryFn: ({ pageParam }) => getPlace(query, pageParam),
getNextPageParam: (lastPage) => {
return lastPage.length > 4 ? lastPage.length : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: 4의 의미가 뭔지 모르겠어요.. 상수라면 따로 빼는게 좋지 않을까요...?

@Miensoap Miensoap deleted the feature/#27 branch November 13, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE 프론트엔드 관련 이슈입니다 ⚙️ 리팩터링 코드 퀄리티를 높입니다 🌱 기능추가 새로운 기능 요청입니다
Projects
None yet
4 participants