There was an error while loading. Please reload this page.
1 parent 39dded8 commit eaba322Copy full SHA for eaba322
1 file changed
src/hooks/useCapabilities.ts
@@ -8,6 +8,8 @@ const Route = getRouteApi('/_app');
8
9
/** Status codes that indicate the grants system is not deployed (vs. access denied). */
10
const GRANTS_UNAVAILABLE_PATTERN = /\b(404|503)\b|endpoint not found|fetch failed/i;
11
+const AUTH_DENIED_PATTERN =
12
+ /\b(401|403)\b|forbidden|unauthorized|authentication required|no admin session token/i;
13
14
export function useCapabilities(): {
15
capabilities: string[];
@@ -27,6 +29,9 @@ export function useCapabilities(): {
27
29
if (GRANTS_UNAVAILABLE_PATTERN.test(message)) {
28
30
return { available: false, capabilities: [] as string[] };
31
}
32
+ if (AUTH_DENIED_PATTERN.test(message)) {
33
+ return { available: true, capabilities: [] as string[] };
34
+ }
35
throw err;
36
37
},
0 commit comments