From 646e8cfde2c2523941366ff19443fdc80b58c83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Hlav=C3=A1=C4=8Dik?= Date: Sat, 9 Dec 2023 22:57:04 +0100 Subject: [PATCH] Ask for filtered menu items (#293) --- src/components/PageLayout/Footer/Footer.tsx | 4 ++-- src/components/PageLayout/MenuMain/MenuMain.tsx | 4 ++-- src/types/api/cms.ts | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/PageLayout/Footer/Footer.tsx b/src/components/PageLayout/Footer/Footer.tsx index 6825a39c..5b169fec 100644 --- a/src/components/PageLayout/Footer/Footer.tsx +++ b/src/components/PageLayout/Footer/Footer.tsx @@ -19,8 +19,8 @@ export const Footer: FC = () => { isLoading: menuItemsIsLoading, error: menuItemsError, } = useQuery({ - queryKey: ['cms', 'menu-item', 'on-site', seminarId], - queryFn: () => axios.get(`/api/cms/menu-item/on-site/${seminarId}`), + queryKey: ['cms', 'menu-item', 'on-site', seminarId, '?footer'], + queryFn: () => axios.get(`/api/cms/menu-item/on-site/${seminarId}?type=footer`), }) const menuItems = menuItemsData?.data ?? [] diff --git a/src/components/PageLayout/MenuMain/MenuMain.tsx b/src/components/PageLayout/MenuMain/MenuMain.tsx index 2fc63502..211ab56d 100644 --- a/src/components/PageLayout/MenuMain/MenuMain.tsx +++ b/src/components/PageLayout/MenuMain/MenuMain.tsx @@ -25,8 +25,8 @@ export const MenuMain: FC = () => { const toggleMenu = () => setIsVisible((currentIsVisible) => !currentIsVisible) const {data: menuItemsData, isLoading: menuItemsIsLoading} = useQuery({ - queryKey: ['cms', 'menu-item', 'on-site', seminarId], - queryFn: () => axios.get(`/api/cms/menu-item/on-site/${seminarId}`), + queryKey: ['cms', 'menu-item', 'on-site', seminarId, '?menu'], + queryFn: () => axios.get(`/api/cms/menu-item/on-site/${seminarId}?type=menu`), }) const menuItems = menuItemsData?.data ?? [] diff --git a/src/types/api/cms.ts b/src/types/api/cms.ts index 2c3cbe37..94ebc38c 100644 --- a/src/types/api/cms.ts +++ b/src/types/api/cms.ts @@ -2,6 +2,8 @@ export interface MenuItemShort { id: number caption: string url: string + in_footer: boolean + in_menu: boolean } export interface PostLink {