From a0eea9649d35ec2a4554632554d53799a36b7f4b Mon Sep 17 00:00:00 2001 From: Martin Porwoll Date: Fri, 20 Feb 2026 13:27:10 +0000 Subject: [PATCH] fix: remove broken type filter from navigation API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The navigations collection has no top-level 'type' field — each tenant has one document with mainMenu and footerMenu arrays. The previous where[type][equals] query caused HTTP 400 on every call. Co-Authored-By: Claude Opus 4.6 --- src/api-client/navigation.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)