moonming opened a new pull request, #3418:
URL: https://github.com/apache/apisix-dashboard/pull/3418
## What
Fixes #3415.
The axios response interceptor converted every **401** into a *resolved*
response carrying fabricated `{ data: {} }`. Every caller treated that as
success:
- a 401'd DELETE showed the green **delete-success toast** (and invalidated
queries) while the resource still existed
- add pages' `onSuccess` handlers read `data.data.value.id` from the
fabricated body → TypeError
- detail pages' suspense queries resolved with `{}` → crash on `data.value.*`
- list pages rendered an empty-cluster illusion
## How
- `src/config/req.ts`: on 401, still open the settings modal, but **reject**
so callers take their normal error path (one-line behavioral core of this PR)
- `src/routes/__root.tsx`: add a root `errorComponent` that keeps
`<SettingsModal/>` mounted with a localized message + Retry button — on a fresh
install every request 401s until the admin key is entered, and the modal is the
only way in (previously the fabricated success masked this; with an honest
reject the default TanStack error dump would have replaced the modal)
- `src/config/global.ts`: queries don't retry on 401 (retries can't succeed
until the user fixes the key; failing fast surfaces the modal immediately)
- `src/components/page/DeleteResourceBtn.tsx`: swallow the rejection after
the interceptor's toast so a failed delete (401/5xx/network) no longer surfaces
as an unhandled promise rejection
- new locale keys `error.title` / `error.retry` in all 5 locales
## Verification
- new regression e2e
`e2e/tests/regression/auth.401-no-false-success.spec.ts`: forces a 401 on
DELETE → asserts settings modal opens, **no success toast**, row survives
- manually verified the fresh-install flow in a real APISIX environment: no
key → localized error + Retry + settings modal; entering the key and clicking
Retry recovers the page
- `pnpm lint` clean, `tsc -b` clean, e2e: new spec + `auth.spec.ts` +
`form.mutation-failure-error.spec.ts` + `services.empty.spec.ts` all pass
locally against a real APISIX
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]