docs(agents): the browser token lives in the pocketbase auth store, not on useAuth

This commit is contained in:
Dave 2026-11-06 19:58:54 +02:00
parent 5ed58c0fc0
commit bbdb235c97

View file

@ -368,6 +368,15 @@ planned phone app lives at `/repairs-app`, not built yet.
delivery note. Repairs do not flow through the customer-DN pipeline.
- `createCustomerQuoteFromRepair` refuses to overwrite an existing
`customer_quote` link unless `replace: true` is passed.
- **The browser token is NOT on the auth context.** `useAuth()` exposes
`user`, `loading` and the auth actions, and **no `token` field** —
`useAuth().token` is `undefined`, so a fetch built from it sends NO
session and every route answers 401 silently. The token lives in the
PocketBase client auth store: `getPocketBase().authStore.token` (see
`delivery-pool/page.tsx` and `search/page.tsx`). Any route that
calls `assertBrowserSession(req)` needs it in the `Authorization`
header — the `x-wfdash-auth` header the global fetch wrapper adds is
audit attribution only, and no route treats it as auth.
- **MERGE GATE — four PocketBase fields must exist before this code
runs:** `repairs.supplier_scope`, `repairs.signed_request`,
`orders.repair`, `giellie_chats.mode`. **PB drops unknown fields