-
Notifications
You must be signed in to change notification settings - Fork 6
스페이스 전체 뷰 페이지 개발 및 로그인 로직 수정 #58
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
Conversation
klmhyeonwoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넘나 고생하셨습니다 : )
src/app/home/RetrospectViewPage.tsx
Outdated
| if (loading || !hasNextPage) return; | ||
|
|
||
| setLoading(true); | ||
| spaceFetch(cursorId, selectedView, 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tanstack-
src/api/Retrospect/index.ts
Outdated
| export const spaceFetch = async (cursorId: number, category: string, pageSize: number) => { | ||
| const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize }; | ||
|
|
||
| const response = await api.get<SpaceFetchResponse>("/api/space/list", { | ||
| params: params, | ||
| }); | ||
| return response.data; | ||
| }; | ||
|
|
||
| type RestrospectResponse = { | ||
| layerCount: number; | ||
| retrospects: { | ||
| retrospectId: number; | ||
| title: string; | ||
| introduction: string; | ||
| isWrite: boolean; | ||
| retrospectStatus: "PROCEEDING" | "DONE"; | ||
| writeCount: number; | ||
| totalCount: number; | ||
| }[]; | ||
| }; | ||
|
|
||
| // space에 있는 회고록 획득 함수 | ||
| export const spaceRestrospectFetch = async (spaceId: number) => { | ||
| const response = await api.get<RestrospectResponse>(`/space/${spaceId}/retrospect`); | ||
| return response.data; | ||
| }; | ||
|
|
||
| // spaceId에 따른 정보 얻는 함수 | ||
| export const spaceInfoFetch = async (spaceId: number) => { | ||
| const response = await api.get<Space>(`api/space/${spaceId}`); | ||
| return response.data; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추후 tanstack 훅 형태로 변경될 예정 맞을까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 변경하였습니다~
| import { Spacing } from "@/component/common/Spacing"; | ||
| import { Typography } from "@/component/common/typography"; | ||
|
|
||
| type RestrospectType = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RetrospectType 이라는 명칭도 물론 좋지만, 공통 Type으로 RetrospectType이라는 친구를 사용하고 있거든요! 회고 유형 자체의 타입을 의미하는! (ex. number / combobox / plain_text ...) 이름이 중복되어서 다른 이름으로 사용해보는것도 좋을 것 같다는 생각입니다! ex) RetrospectBoxType
donghunee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
�🍀고생하셨습니다🍀 갓시현!!
src/api/Retrospect/index.ts
Outdated
| const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize }; | ||
|
|
||
| const response = await api.get<SpaceFetchResponse>("/api/space/list", { | ||
| params: params, | ||
| }); | ||
| return response.data; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const params = category !== "ALL" ? { cursorId: cursorId, category: category, pageSize: pageSize } : { cursorId: cursorId, pageSize: pageSize }; | |
| const response = await api.get<SpaceFetchResponse>("/api/space/list", { | |
| params: params, | |
| }); | |
| return response.data; | |
| }; | |
| const response = await api.get<SpaceFetchResponse>("/api/space/list", { | |
| params: { | |
| cursorId, | |
| pageSize, | |
| ...(category !== ALL && { category }) | |
| }, | |
| }); | |
| return response.data; | |
| }; |
요렇게 단순화 할 수 있을 것 같아요..!!
| { viewName: "전체", selected: true }, | ||
| { viewName: "개인", selected: false }, | ||
| { viewName: "팀", selected: false }, | ||
| { viewName: "ALL", selected: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewName type을 string보단 union이나 enum으로 설정하는 것이 좋아보여요~!
leeminhee119
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨슴다 !!
| return response.data; | ||
| }; | ||
|
|
||
| export const useGetSpaceAndRetrospect = (spaceId?: string): UseQueryOptions<RestrospectResponse, Error, RestrospectResponse, [string]> => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일이름도 동일하게 작성하면 좋을 것 같아요 !!
| if (getSpaceInfo.isSuccess && getRetrospects.isSuccess) { | ||
| setSpaceInfo(getSpaceInfo.data); | ||
| setLayerCount(getRetrospects.data?.layerCount); | ||
| setRestrospectArr(getRetrospects.data?.retrospects); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useQuery가 반환하는 데이터를 바로 사용하지 않고 useState로 한 번 더 감싸는 이유가 있을까요 ?!
| }; | ||
|
|
||
| const spaceRestrospectFetch = async (spaceId: string | undefined) => { | ||
| const response = await api.get<RestrospectResponse>(`/space/${spaceId}/retrospect`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 여기다 데이터 타입을 지정해주면 되는구나 !! 나도 수정해야게따
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어엇 이거 common에 Tag 있는데 좀 다른 걸까요 ??
🏄🏼♂️ Summary (요약)
🫨 Describe your Change (변경사항)
=> 이러한 접근으로 400으로 상태 코드를 수정하였고, 이를 반영하여 코드를 수정했습니다.
🧐 Issue number and link (참고)
📚 Reference (참조)