Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask for filtered menu items #293

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading