chore: 사용자 팝업 조회 로직 수정

This commit is contained in:
2025-06-24 13:24:50 +09:00
parent 2c6295a467
commit 42dd76cf4d
2 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -54,9 +54,9 @@ interface PageableList<T> {
const client = getApiClient();
export const getPopupList = async () => {
export const getUserPopupList = async () => {
const response = await client.get<PageableList<PopupInfo>>(
`${ENDPOINT.CMS_SERVICE.POPUPS}`,
`${ENDPOINT.CMS_SERVICE.POPUPS}/user/list`,
);
return response.data;
};
@@ -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 (
<header className="sticky top-0 z-30 box-border flex h-[5rem] w-full items-center justify-between border-b border-solid border-border bg-background">