Skip to content

Commit fd09b68

Browse files
authored
Merge pull request #275 from Nexters/fix/popup-api-path
fix: pop up api path 변경점 적용
2 parents 8518721 + d5d2601 commit fd09b68

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

Diff for: apps/admin/src/pages/HomePage/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const HomePage = () => {
4444
const { data: userProfileData, isLoading: isUserProfileLoading } = useUserProfile();
4545
const { data: showList = [], isLoading: isShowListLoading } = useShowList();
4646
const { data: settlementBanners } = useSettlementBanners();
47-
const { data: popupData } = usePopup();
47+
const { data: popupData } = usePopup('HOME');
4848
usePopupDialog(popupData);
4949

5050
const { imgPath, nickname = '', userCode } = userProfileData ?? {};

Diff for: packages/api/src/queries/usePopup.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useQuery } from '@tanstack/react-query';
22

33
import { queryKeys } from '../queryKey';
4+
import { PopupViewType } from '../types';
45

5-
const usePopup = () => useQuery(queryKeys.popup.info);
6+
const usePopup = (view: PopupViewType) => useQuery(queryKeys.popup.info(view));
67

78
export default usePopup;

Diff for: packages/api/src/queryKey.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
TicketStatus,
2626
TicketType,
2727
Popup,
28+
PopupViewType,
2829
} from './types';
2930
import {
3031
AdminShowDetailResponse,
@@ -134,8 +135,7 @@ export const adminShowQueryKeys = createQueryKeys('adminShow', {
134135
}),
135136
settlementStatement: (showId: number) => ({
136137
queryKey: [showId],
137-
queryFn: () =>
138-
instance.get(`sa-api/v1/shows/${showId}/settlement-statements/last/file`).blob(),
138+
queryFn: () => instance.get(`sa-api/v1/shows/${showId}/settlement-statements/last/file`).blob(),
139139
}),
140140
ticketSalesInfo: (showId: number) => ({
141141
queryKey: [showId],
@@ -453,10 +453,10 @@ export const castTeamQueryKeys = createQueryKeys('castTeams', {
453453
});
454454

455455
export const popupQueryKeys = createQueryKeys('popup', {
456-
info: {
457-
queryKey: null,
458-
queryFn: () => fetcher.get<Popup>('web/papi/v1/popup'),
459-
},
456+
info: (view: PopupViewType) => ({
457+
queryKey: [view],
458+
queryFn: () => fetcher.get<Popup>(`web/papi/v1/popup/${view}`),
459+
}),
460460
});
461461

462462
export const queryKeys = mergeQueryKeys(

Diff for: packages/api/src/types/popup.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ export interface Popup {
22
id: number;
33
type: 'EVENT' | 'NOTICE';
44
eventUrl: string | null;
5-
view: 'Home';
65
noticeTitle: string | null;
76
description: string;
87
startDate: string;
98
endDate: string;
109
}
10+
11+
export type PopupViewType = 'HOME' | 'SHOW';

0 commit comments

Comments
 (0)