From 370ba3406f271c6ecb31f30960816a140c794e39 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Thu, 30 Jul 2026 22:33:47 +0200 Subject: [PATCH] refactor(hunt): replace admin middleware with auth and implement membership state - Change middleware from 'admin' to 'auth' on hunt and quest admin pages - Add global hunt store to track current hunt ID and membership status - Use hunt store membership state to conditionally display admin UI elements - Handle fetch errors gracefully with alerts and back navigation buttons - Update admin UI logic to depend on membership state instead of user role - Add membership state update after API calls in hunt, quest, teams, and admin pages - Refactor UI templates to show error messages when fetch fails - Centralize membership logic for better authorization control in frontend --- app/layouts/default.vue | 15 +- .../hunt/[huntSlug]/[questSlug]/admin.vue | 104 +++-- .../hunt/[huntSlug]/[questSlug]/index.vue | 15 +- app/pages/hunt/[huntSlug]/admin.vue | 415 +++++++++--------- app/pages/hunt/[huntSlug]/index.vue | 4 + app/pages/hunt/[huntSlug]/teams.vue | 45 +- app/stores/hunt.ts | 14 + 7 files changed, 351 insertions(+), 261 deletions(-) create mode 100644 app/stores/hunt.ts diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 9cf1f27..8b9263c 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -1,5 +1,6 @@