diff --git a/src/api-client/navigation.ts b/src/api-client/navigation.ts index 2923551..ded0829 100644 --- a/src/api-client/navigation.ts +++ b/src/api-client/navigation.ts @@ -1,5 +1,8 @@ /** * Navigation API functions + * + * Each tenant has ONE navigation document with mainMenu (header) and footerMenu arrays. + * There is no top-level 'type' field — access nav.mainMenu / nav.footerMenu directly. */ import type { Navigation } from '../types/collections' import type { PaginatedResponse, CollectionQueryParams } from '../types/api' @@ -8,19 +11,19 @@ import type { PayloadClient } from './client' export function createNavigationApi(client: PayloadClient) { return { /** - * Get navigation by type (header, footer, mobile, etc.) + * Get the navigation document for the current tenant. + * Returns a single document with `mainMenu` and `footerMenu` arrays. */ - async getNavigation(type: string, options?: Pick): Promise { + async getNavigation(options?: Pick): Promise { const result = await client.getCollection('navigations', { ...options, - where: { 'type][equals': type }, limit: 1, }) return result.docs[0] ?? null }, /** - * Get all navigations + * Get all navigations (multi-tenant admin usage) */ async getNavigations(options?: CollectionQueryParams): Promise> { return client.getCollection('navigations', options)