mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 06:37:33 +00:00
fix(admin): stop asking for OIDC config where the route is closed
On a centrally administered install /api/admin/oidc answers 403, and the admin page asked anyway. The promise was caught, so nothing broke, but the request still went out and still printed a red 403 in the console of every admin who opened the page. Swallowing a rejection hides a failure from the code, not from the person reading the console.
This commit is contained in:
@@ -121,7 +121,11 @@ export function useAdmin() {
|
||||
loadData()
|
||||
loadAppConfig()
|
||||
loadApiKeys()
|
||||
adminApi.getOidc().then(setOidcConfig).catch(() => {})
|
||||
// Skipped rather than caught when the route is closed to us: the request
|
||||
// still reaches the network, still answers 403, and still prints a red line
|
||||
// in the console of every admin who opens this page. Swallowing the promise
|
||||
// hides it from the code, not from the reader.
|
||||
if (!managed) adminApi.getOidc().then(setOidcConfig).catch(() => {})
|
||||
// The operator decides when this instance upgrades, so there is nothing to
|
||||
// check and nothing the admin could act on.
|
||||
if (managed) return
|
||||
|
||||
Reference in New Issue
Block a user