<template>
  <div class="flex flex-col h-full w-full overflow-y-auto">
    <p>{{ communications }}</p>
    <Spinner v-if="loading == 'loading'" class="mx-auto" />
    <p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
  </div>
</template>

<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import { useMemberStore } from "@/stores/admin/member";
import type { MemberViewModel, UpdateMemberViewModel } from "@/viewmodels/admin/member.models";
import Spinner from "@/components/Spinner.vue";
import type { CommunicationViewModel } from "@/viewmodels/admin/communication.models";
import { useCommunicationStore } from "@/stores/admin/communication";
</script>

<script lang="ts">
export default defineComponent({
  computed: {
    ...mapState(useCommunicationStore, ["communications", "loading"]),
  },
  mounted() {
    this.fetchItem();
  },
  methods: {
    ...mapActions(useCommunicationStore, ["fetchCommunicationsForMember"]),
    fetchItem() {
      this.fetchCommunicationsForMember();
    },
  },
});
</script>
