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
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export const useHuntStore = defineStore('hunt', () => {
|
||||
const huntId = ref<number>();
|
||||
const isMember = ref(false);
|
||||
|
||||
function setMembership(id: number, member: boolean) {
|
||||
huntId.value = id;
|
||||
isMember.value = member;
|
||||
}
|
||||
|
||||
return { huntId, isMember, setMembership };
|
||||
});
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(acceptHMRUpdate(useHuntStore, import.meta.hot));
|
||||
}
|
||||
Reference in New Issue
Block a user