Aman-Mittal opened a new pull request, #846:
URL: https://github.com/apache/fineract-backoffice-ui/pull/846
Closes the remaining half of #749. The OIDC half was fixed earlier; this
screen was not.
## Two opposite answers that looked identical
`GET /twofactor/configure` can answer 404 — this tenant has no configuration
yet — or fail. The screen treated both the same way:
```ts
error: () => {
this.isLoading.set(false);
},
```
Either way the operator got an empty JSON editor, which reads as *"this
tenant has no second factor configured"*. On a real failure that is wrong, and
saving from that state would have written the empty editor over whatever was
actually there.
404 now opens the editor, deliberately, and for the reason the OIDC screen
already gives for doing the same:
> A tenant with no configuration answers 404, which is an answer and not a
failure: it means "create one", and the form should open on the defaults rather
than shout.
Anything else shows the shared `app-load-error` panel with **Try again** and
raises an error toast — the pattern #660 and #611 established and #763 asked
for — and withholds the editor rather than offering one that cannot be trusted.
## A green toast for a failure
A JSON parse failure on save was reported through `notifications.success`,
so "Invalid JSON" arrived in the success colour. It goes through
`notifications.error` now.
## Tests
A new spec, since this component had none:
- a 404 opens the editor, with no error state and no toast — a tenant
without a configuration is not a failure
- a 500 shows the error panel, withholds the editor, toasts, and **Try
again** reloads and recovers
- invalid JSON on save sends no request and raises an `error-toast`,
asserted on the toast's `cssClass` so the colour is part of the test rather
than the wording alone
## Checks
- unit suite 321 files / 2744 tests green, 3 of them new here
- `lint` silent with `eslint-suppressions.json` unchanged; `format:check`
clean on tracked files; `tsc` clean
- `i18n:check` consistent, with `fr` and `hi` carrying the new `LOAD_FAILED`
key
--
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]