diff --git a/packages/common/components/src/api/popup.ts b/packages/common/components/src/api/popup.ts index 85c5ac312..0fee0f5b7 100644 --- a/packages/common/components/src/api/popup.ts +++ b/packages/common/components/src/api/popup.ts @@ -54,9 +54,9 @@ interface PageableList { const client = getApiClient(); -export const getPopupList = async () => { +export const getUserPopupList = async () => { const response = await client.get>( - `${ENDPOINT.CMS_SERVICE.POPUPS}`, + `${ENDPOINT.CMS_SERVICE.POPUPS}/user/list`, ); return response.data; }; diff --git a/packages/common/components/src/ui/header/index.tsx b/packages/common/components/src/ui/header/index.tsx index 6e0f89393..8457b28dd 100644 --- a/packages/common/components/src/ui/header/index.tsx +++ b/packages/common/components/src/ui/header/index.tsx @@ -8,7 +8,7 @@ import { ENDPOINT } from "../../config"; import { setCookie, getCookie } from "../../lib"; import { getPopupInfo, - getPopupList, + getUserPopupList, getSiteInfo, getUserInfo, type PopupInfo, @@ -45,9 +45,9 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) { enabled: !viewOnly, }); - const { data: popupList } = useQuery({ + const { data: userPopupList } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.POPUPS], - queryFn: () => getPopupList(), + queryFn: () => getUserPopupList(), }); const openPopup = useCallback(async (popup: PopupInfo) => { @@ -79,16 +79,16 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) { }, []); useEffect(() => { - if (!popupList?.content.length) return; + if (!userPopupList?.content?.length) return; const timer = setTimeout(() => { - popupList.content.forEach((popup) => { + userPopupList.content.forEach((popup) => { openPopup(popup); }); }, 500); return () => clearTimeout(timer); - }, [popupList, openPopup]); + }, [userPopupList, openPopup]); return (