Add team member and hunt member management for admins

This commit is contained in:
2025-08-10 00:20:44 +02:00
parent dc3c21f885
commit befc678bdb
15 changed files with 1009 additions and 12 deletions
+54
View File
@@ -0,0 +1,54 @@
<script setup lang="ts">
import Team from '~/components/admin/Team.vue';
import { useTitleStore } from '~/stores/title';
definePageMeta({
middleware: ['admin']
});
const app = useNuxtApp();
const { loggedIn } = useUserSession();
const localePath = useLocalePath();
const { t } = useI18n();
const router = useRouter();
const { name, id } = app.$slugData.huntSlug!;
const titleStore = useTitleStore();
const { data, pending, refresh } = await useFetch(
`/api/admin/hunt/${id}/teams`
);
useHead({
title: t('layouts.title', {
title: data.value?.name || name
})
});
watch(loggedIn, (isLoggedIn) => {
if (!isLoggedIn) {
router.push(localePath('/login'));
}
});
titleStore.title = data.value?.name;
type Data = NonNullable<(typeof data)['value']>;
export type Team = Data['teams'][number];
</script>
<template>
<h1>teams</h1>
<VaButton color="success" icon="replay" @click="refresh">Refresh</VaButton>
<VaAccordion v-if="data" stateful>
<Team
v-for="team in data.teams"
:key="team.id"
:team="team"
:huntId="id"
@refresh="refresh"
/>
</VaAccordion>
</template>
<style scoped></style>