<template>
  <MainTemplate title="offene Einladungen">
    <template #headerInsert>
      <RouterLink :to="{ name: 'admin-management-user' }" class="text-primary">zurück zur Nutzerliste</RouterLink>
    </template>
    <template #main>
      <InviteListItem v-for="invite in invites" :key="invite.username" :invite="invite" />
    </template>
  </MainTemplate>
</template>

<script setup lang="ts">
import { defineComponent, markRaw, defineAsyncComponent } from "vue";
import { mapState, mapActions } from "pinia";
import MainTemplate from "@/templates/Main.vue";
import { useInviteStore } from "@/stores/admin/management/invite";
import InviteListItem from "@/components/admin/management/user/InviteListItem.vue";
</script>

<script lang="ts">
export default defineComponent({
  computed: {
    ...mapState(useInviteStore, ["invites"]),
  },
  mounted() {
    this.fetchInvites();
  },
  methods: {
    ...mapActions(useInviteStore, ["fetchInvites"]),
  },
});
</script>
