Gate order-list filters behind CompanySettings.orderFilterEnabled
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1070,6 +1070,21 @@ export async function getBlogFilterEnabled(): Promise<boolean> {
|
||||
return data.docs?.[0]?.blogFilterEnabled ?? false;
|
||||
}
|
||||
|
||||
// Same pattern — gates /konto/bestellungen's status/paymentStatus/year filters.
|
||||
export async function getOrderFilterEnabled(): Promise<boolean> {
|
||||
const params = new URLSearchParams({ "where[tenant.slug][equals]": TENANT_SLUG, limit: "1" });
|
||||
const res = await fetch(`${PAYLOAD_URL}/api/company-settings?${params}`, {
|
||||
headers: { "x-order-service-secret": process.env.ORDER_SERVICE_SECRET || "" },
|
||||
next: { revalidate: 60 },
|
||||
});
|
||||
if (!res.ok) {
|
||||
console.error(`getOrderFilterEnabled: Payload returned ${res.status} ${res.statusText}`);
|
||||
return false;
|
||||
}
|
||||
const data: { docs?: { orderFilterEnabled?: boolean }[] } = await res.json();
|
||||
return data.docs?.[0]?.orderFilterEnabled ?? false;
|
||||
}
|
||||
|
||||
export type SeoSettings = {
|
||||
defaultTitle: string | null;
|
||||
titleTemplate: string | null;
|
||||
|
||||
Reference in New Issue
Block a user