feat: wire validation accept -> PATCH order status=accepted (closes the 50/50 escrow loop in UI)
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
@@ -36,6 +36,17 @@ export default function ValidationPage() {
|
|||||||
|
|
||||||
const toggleDest = (d: string) => setDests((p) => (p.includes(d) ? p.filter((x) => x !== d) : [...p, d]));
|
const toggleDest = (d: string) => setDests((p) => (p.includes(d) ? p.filter((x) => x !== d) : [...p, d]));
|
||||||
|
|
||||||
|
async function approve() {
|
||||||
|
try {
|
||||||
|
await fetch(`/api/orders/${id}`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ status: "accepted" }),
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
setApproved(true);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main ref={ref} className="min-h-screen bg-background text-foreground">
|
<main ref={ref} className="min-h-screen bg-background text-foreground">
|
||||||
<OrderStepper active={4} />
|
<OrderStepper active={4} />
|
||||||
@@ -248,7 +259,7 @@ export default function ValidationPage() {
|
|||||||
Revidera
|
Revidera
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setApproved(true)}
|
onClick={approve}
|
||||||
className="bg-foreground px-5 py-3 font-mono text-[12px] uppercase tracking-[0.1em] text-background transition-colors hover:bg-[var(--accent-red)]"
|
className="bg-foreground px-5 py-3 font-mono text-[12px] uppercase tracking-[0.1em] text-background transition-colors hover:bg-[var(--accent-red)]"
|
||||||
>
|
>
|
||||||
Godkänn · frigör 50 %
|
Godkänn · frigör 50 %
|
||||||
|
|||||||
Reference in New Issue
Block a user