From c908d4dffc8fc2f343cb546429b83a6cc70b41a2 Mon Sep 17 00:00:00 2001 From: matushl Date: Sat, 9 Dec 2023 21:52:08 +0100 Subject: [PATCH] Ask for filtered menu items --- 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 {