mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-10-19 05:57:31 +02:00
fix: cache empty team scope
This commit is contained in:
1 parent
d07ac810fa
commit
bf2e2e0ba7
1 file changed
+3
-1
@@ -75,7 +75,9 @@ export class AuthGuard implements CanActivate {
|
||||
if (!resp.ok) {
|
||||
throw new Error(`team-scope resolver returned ${resp.status}`);
|
||||
}
|
||||
const value = (await resp.json()) as TeamScope | null;
|
||||
// A user with no team is answered with an empty body, not `null`.
|
||||
const body = await resp.text();
|
||||
const value = (body ? JSON.parse(body) : null) as TeamScope | null;
|
||||
|
||||
// Bound the cache; a coarse clear is fine since entries are cheap to rebuild.
|
||||
if (this.teamScopeCache.size > 10_000) this.teamScopeCache.clear();
|
||||
|
||||
Reference in new issue
Block a user