Skip to content
Open
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
12 changes: 3 additions & 9 deletions src/domains/club/introduction/api/introduction.mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ import { apiRequest } from '@/api/apiRequest';
/**
* 동아리 상세 정보 입력 및 수정
*/
export const useUpdateClubIntroMutation = () => {
export const useUpdateClubIntroMutation = (clubId?: string) => {
const { handleError } = useErrorHandler();

return useMutation({
mutationFn: async ({
data,
clubId,
}: {
data: IntroSchema;
clubId: number;
}) => {
mutationFn: async ({ data }: { data: IntroSchema }) => {
return await apiRequest({
url: `/api/clubs/club-admin/${clubId}`,
method: 'POST',
Expand All @@ -27,7 +21,7 @@ export const useUpdateClubIntroMutation = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['clubs'],
queryKey: ['clubs', 'introduction', clubId],
});
},
onError: (error) => {
Expand Down
29 changes: 16 additions & 13 deletions src/domains/club/introduction/api/introduction.queries.ts
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
Expand Up @@ -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
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

useUpdateClubIntroMutation now captures clubId in the hook signature, so the mutate call should only need the data payload. The current form logic still builds/passes { data, clubId: Number(clubId) }, which is now redundant and can be misleading (the mutationFn ignores clubId). Update the submit payload to match the new mutation input shape.

Copilot uses AI. Check for mistakes.
useEffect(() => {
if (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/domains/club/recruitment/api/recruitment.mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const useUpdateRecruitStatusMutation = (clubId: number) => {

onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['clubs'],
queryKey: ['clubs', 'recruitment', clubId],
});
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

useUpdateRecruitStatusMutation now invalidates only ['clubs','recruitment',clubId], but the UI that triggers this mutation (e.g. the admin dashboard) reads recruitmentStatus from useClubOverviewQuery (queryKey starts with ['clubs','profile',clubId,...]). With the narrower invalidation, the dashboard status can remain stale after an update. Consider also invalidating the relevant overview/profile query key (or using a broader partial key like ['clubs', clubId] / ['clubs']) so recruitmentStatus is refetched.

Suggested change
});
});
queryClient.invalidateQueries({
queryKey: ['clubs', 'profile', clubId],
});

Copilot uses AI. Check for mistakes.
},
});
Expand Down
1 change: 0 additions & 1 deletion src/domains/club/recruitment/api/recruitment.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const useClubRecruitmentQuery = ({
apiRequest({
url: `/api/clubs/${clubId}/recruitment`,
method: 'GET',
requireToken: true,
}),
staleTime: 1000 * 60 * 5,
select: (data) => data.result,
Expand Down