-
Notifications
You must be signed in to change notification settings - Fork 3
동아리 어드민 쿼리 개선, 동아리 모집 쿼리 오류 수정 #272
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| import { apiRequest } from '@/api/apiRequest'; | ||
| import { ClubDetailResponse } from '@/api/data-contracts'; | ||
| import { | ||
| ClubDetailQueryProps, | ||
| useClubApi, | ||
| } from '@/domains/shared/api/club.queries'; | ||
| import { APIResponse } from '@/types/api.types'; | ||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| /** | ||
| * 동아리 상세 정보 조회 | ||
| * 동아리 상세 정보 조회 (동아리 소개) | ||
| */ | ||
| export const useClubIntroQuery = ({ | ||
| clubId, | ||
| isPreview, | ||
| }: ClubDetailQueryProps) => | ||
| useClubApi<ClubDetailResponse>({ | ||
| clubId, | ||
| isPreview, | ||
| errorMessage: '동아리 정보 조회 실패', | ||
| export const useClubIntroQuery = (clubId?: string) => { | ||
| return useQuery({ | ||
| queryKey: ['clubs', 'introduction', clubId], | ||
| queryFn: async (): Promise<APIResponse<ClubDetailResponse>> => | ||
| apiRequest({ | ||
| url: `/api/clubs/${clubId}`, | ||
| method: 'GET', | ||
| }), | ||
| staleTime: 1000 * 60 * 5, | ||
| select: (data) => data.result, | ||
| enabled: !!clubId, | ||
| }); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,11 +31,8 @@ export default function ClubIntroductionForm() { | |
| }); | ||
| const modal = useModal(); | ||
|
|
||
| const { data } = useClubIntroQuery({ | ||
| clubId, | ||
| isPreview: false, | ||
| }); | ||
| const { mutate: update } = useUpdateClubIntroMutation(); | ||
| const { data } = useClubIntroQuery(clubId); | ||
| const { mutate: update } = useUpdateClubIntroMutation(clubId); | ||
|
|
||
|
Comment on lines
+34
to
36
|
||
| useEffect(() => { | ||
| if (data) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,7 +21,7 @@ export const useUpdateRecruitStatusMutation = (clubId: number) => { | |||||||||||
|
|
||||||||||||
| onSuccess: () => { | ||||||||||||
| queryClient.invalidateQueries({ | ||||||||||||
| queryKey: ['clubs'], | ||||||||||||
| queryKey: ['clubs', 'recruitment', clubId], | ||||||||||||
| }); | ||||||||||||
|
||||||||||||
| }); | |
| }); | |
| queryClient.invalidateQueries({ | |
| queryKey: ['clubs', 'profile', clubId], | |
| }); |
Uh oh!
There was an error while loading. Please reload this page.