Return 200+null instead of 404 when no cash up found for date — eliminates browser console error
This commit is contained in:
parent
ed9cce1d76
commit
37453ddfda
2 changed files with 6 additions and 6 deletions
|
|
@ -177,14 +177,14 @@ export function DailyCashUp({ user }: Props) {
|
|||
setCheckedItems(new Set())
|
||||
|
||||
api.get<{
|
||||
cash_up: CashUp; denominations: Denomination[]; card_machines: CardMachine[];
|
||||
cash_up: CashUp | null; denominations: Denomination[]; card_machines: CardMachine[];
|
||||
reconciliation: ReconciliationRow[]; attachments: Attachment[]
|
||||
}>(`/cashup?date=${date}`)
|
||||
.then(data => applyLoaded(data))
|
||||
.catch(e => {
|
||||
if (e instanceof Error && e.message === 'Not found') setPageState('empty')
|
||||
else { flash('Failed to load data for this date.', false); setPageState('empty') }
|
||||
.then(data => {
|
||||
if (!data.cash_up) { setPageState('empty'); return }
|
||||
applyLoaded(data as { cash_up: CashUp; denominations: Denomination[]; card_machines: CardMachine[]; attachments: Attachment[] })
|
||||
})
|
||||
.catch(() => { flash('Failed to load data for this date.', false); setPageState('empty') })
|
||||
|
||||
// Auto-fetch Newbook — soft failure, user can retry with the button
|
||||
api.post<{ count: number; totals: PaymentTotals; till_payments: TillPayment[]; transaction_breakdown: TransactionBreakdown }>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue