Skip to content

fix: pop up api path 변경점 적용 #275

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

Merged
merged 1 commit into from
Feb 2, 2025
Merged
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
2 changes: 1 addition & 1 deletion apps/admin/src/pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ const HomePage = () => {
const { data: userProfileData, isLoading: isUserProfileLoading } = useUserProfile();
const { data: showList = [], isLoading: isShowListLoading } = useShowList();
const { data: settlementBanners } = useSettlementBanners();
const { data: popupData } = usePopup();
const { data: popupData } = usePopup('HOME');
usePopupDialog(popupData);

const { imgPath, nickname = '', userCode } = userProfileData ?? {};
3 changes: 2 additions & 1 deletion packages/api/src/queries/usePopup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useQuery } from '@tanstack/react-query';

import { queryKeys } from '../queryKey';
import { PopupViewType } from '../types';

const usePopup = () => useQuery(queryKeys.popup.info);
const usePopup = (view: PopupViewType) => useQuery(queryKeys.popup.info(view));

export default usePopup;
12 changes: 6 additions & 6 deletions packages/api/src/queryKey.ts
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ import {
TicketStatus,
TicketType,
Popup,
PopupViewType,
} from './types';
import {
AdminShowDetailResponse,
@@ -134,8 +135,7 @@ export const adminShowQueryKeys = createQueryKeys('adminShow', {
}),
settlementStatement: (showId: number) => ({
queryKey: [showId],
queryFn: () =>
instance.get(`sa-api/v1/shows/${showId}/settlement-statements/last/file`).blob(),
queryFn: () => instance.get(`sa-api/v1/shows/${showId}/settlement-statements/last/file`).blob(),
}),
ticketSalesInfo: (showId: number) => ({
queryKey: [showId],
@@ -453,10 +453,10 @@ export const castTeamQueryKeys = createQueryKeys('castTeams', {
});

export const popupQueryKeys = createQueryKeys('popup', {
info: {
queryKey: null,
queryFn: () => fetcher.get<Popup>('web/papi/v1/popup'),
},
info: (view: PopupViewType) => ({
queryKey: [view],
queryFn: () => fetcher.get<Popup>(`web/papi/v1/popup/${view}`),
}),
});

export const queryKeys = mergeQueryKeys(
3 changes: 2 additions & 1 deletion packages/api/src/types/popup.ts
Original file line number Diff line number Diff line change
@@ -2,9 +2,10 @@ export interface Popup {
id: number;
type: 'EVENT' | 'NOTICE';
eventUrl: string | null;
view: 'Home';
noticeTitle: string | null;
description: string;
startDate: string;
endDate: string;
}

export type PopupViewType = 'HOME' | 'SHOW';

Unchanged files with check annotations Beta

};
reset();
}, []);

Check warning on line 53 in apps/admin/src/components/ErrorBoundary/AuthErrorBoundary.tsx

GitHub Actions / Build and Test

React Hook useEffect has missing dependencies: 'error', 'navigate', and 'resetErrorBoundary'. Either include them or remove the dependency array. If 'resetErrorBoundary' changes too often, find the parent component that defines it and wrap that definition in useCallback
return null;
};
});
return;
}
}, [popupData]);

Check warning on line 59 in apps/admin/src/hooks/usePopupDialog.tsx

GitHub Actions / Build and Test

React Hook useEffect has missing dependencies: 'eventPopupDialog', 'getCookie', and 'noticePopupDialog'. Either include them or remove the dependency array
};
export default usePopupDialog;