diff --git a/src/lib/api.ts b/src/lib/api.ts index 664b50e..c76912d 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -268,6 +268,19 @@ export async function fetchFormats(): Promise { return data?.data ?? []; } +/** + * Formate für den Textmengencheck: alle mit show_check=true. Das sind die + * Text-Seiten-Formate (A4, A5, DIN lang, A6) – unabhängig davon, ob sie im + * öffentlichen Konfigurator bestellbar sind. Adress-Postkarten sind ausgenommen. + */ +export async function fetchCheckFormats(): Promise { + const data = await request( + '/items/formats?fields=id,key,name,product&filter[show_check][_eq]=true&limit=-1', + { auth: false }, + ); + return data?.data ?? []; +} + /* ── Preis & Bestellung (Extension skrift-orders) ─────────────────────────── */ export type QuoteLine = { label: string; amount: number; per_unit?: boolean }; diff --git a/src/routes/Textmenge.tsx b/src/routes/Textmenge.tsx index 4c146f0..970720c 100644 --- a/src/routes/Textmenge.tsx +++ b/src/routes/Textmenge.tsx @@ -1,5 +1,5 @@ import { useEffect, useMemo, useState } from 'react'; -import { fetchFormats, fetchSettings, generatePreview } from '../lib/api'; +import { fetchCheckFormats, fetchSettings, generatePreview } from '../lib/api'; import type { Format, PublicSettings, PreviewDoc, PreviewOverflow } from '../lib/api'; /** Schriftarten wie im Konfigurator/manuellen Druck. */ @@ -99,7 +99,7 @@ export default function Textmenge() { const [gross, setGross] = useState(false); useEffect(() => { - fetchFormats() + fetchCheckFormats() .then((f) => { setFormate(f); setFormat(f.find((x) => x.key === 'a4')?.key ?? f[0]?.key ?? 'a4');