Files
frontend/packages/common/components/src/api/popup.ts
T

70 lines
1.4 KiB
TypeScript

import { getApiClient } from "./client";
import { ENDPOINT } from "../config";
export interface PopupInfo {
popupSn: number;
popupTypeCd: string;
popupTypeNm: string;
contsTypeCd: string;
contsTypeNm: string;
popupTtl: string;
popupCn: string;
popupWdth: number;
popupHgt: number;
popupVtclPstn: number;
popupHrzntltyPstn: number;
popupEndUseYn: string;
popupLnkgUrl: string;
atflCd: string;
useYn: string;
regDt: string;
mdfcnDt: string;
rgTrNm: string;
mdfrNm: string;
}
interface SortConfig {
empty: boolean;
sorted: boolean;
unsorted: boolean;
}
interface PageableConfig {
sort: SortConfig;
offset: number;
pageNumber: number;
pageSize: number;
paged: boolean;
unpaged: boolean;
}
interface PageableList<T> {
content: T[];
pageable: PageableConfig;
sort: SortConfig;
totalPages: number;
totalElements: number;
number: number;
numberOfElements: number;
size: number;
first: boolean;
last: boolean;
empty: boolean;
}
const client = getApiClient();
export const getPopupList = async () => {
const response = await client.get<PageableList<PopupInfo>>(
`${ENDPOINT.CMS_SERVICE.POPUPS}`,
);
return response.data;
};
export const getPopupInfo = async (popupSn: number) => {
const response = await client.get<PopupInfo>(
`${ENDPOINT.CMS_SERVICE.POPUPS}/${popupSn}`,
);
return response.data;
};