Skip to content

Commit

Permalink
Ask for filtered menu items (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matushl authored Dec 9, 2023
1 parent 5ed5aff commit 646e8cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/PageLayout/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const Footer: FC = () => {
isLoading: menuItemsIsLoading,
error: menuItemsError,
} = useQuery({
queryKey: ['cms', 'menu-item', 'on-site', seminarId],
queryFn: () => axios.get<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}`),
queryKey: ['cms', 'menu-item', 'on-site', seminarId, '?footer'],
queryFn: () => axios.get<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}?type=footer`),
})
const menuItems = menuItemsData?.data ?? []

Expand Down
4 changes: 2 additions & 2 deletions src/components/PageLayout/MenuMain/MenuMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}`),
queryKey: ['cms', 'menu-item', 'on-site', seminarId, '?menu'],
queryFn: () => axios.get<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}?type=menu`),
})
const menuItems = menuItemsData?.data ?? []

Expand Down
2 changes: 2 additions & 0 deletions src/types/api/cms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export interface MenuItemShort {
id: number
caption: string
url: string
in_footer: boolean
in_menu: boolean
}

export interface PostLink {
Expand Down

0 comments on commit 646e8cf

Please sign in to comment.