From f8955be4e967340ce3b8eb17eb80dcc4844edc91 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 11 Jun 2026 08:28:25 +0000 Subject: [PATCH] feat(web): filter by ownerId and surface missing-role 401 state Co-Authored-By: Claude Fable 5 --- app/composables/useAuth.ts | 12 +++++++++- app/pages/index.vue | 45 ++++++++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/app/composables/useAuth.ts b/app/composables/useAuth.ts index a11bca6..7d95bcd 100644 --- a/app/composables/useAuth.ts +++ b/app/composables/useAuth.ts @@ -1,5 +1,15 @@ import type { ZitadelAuth } from "@kuns/zitadel-auth"; +/** API call failure carrying the HTTP status (401 = authenticated but not authorized). */ +export class ApiError extends Error { + constructor( + message: string, + public status: number, + ) { + super(message); + } +} + // Access the bootstrap-provided Zitadel auth instance + a small JSON helper for /api calls. // By the time any component mounts, the plugin has gated auth, so `auth` is authenticated. // `auth.fetch` auto-attaches the Bearer access token. @@ -16,7 +26,7 @@ export function useAuth() { } catch { // non-JSON error body } - throw new Error(message); + throw new ApiError(message, res.status); } if (res.status === 204) return undefined as T; return (await res.json()) as T; diff --git a/app/pages/index.vue b/app/pages/index.vue index 88138c6..819fc54 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,7 +1,10 @@