fix(pages): bands page bug

fix error being thrown for unauthenticated users because of null value
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2024-12-08 22:49:37 -05:00
parent 2dde6c381b
commit f0b107c2fd
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -1,8 +1,7 @@
<script lang="ts" setup>
import { IBand } from "@models/band";
import icon from "~/components/icon.vue";
import { subscriptions, bp } from "@client/listActions";
import { IUser } from "@models/user";
import { subscriptions } from "@client/listActions";
const { data: bands } = (await useApiFetch<NonNullable<IBand[]>>("/band/all")) as unknown as { data: Ref<IBand[]> };
@ -25,7 +24,7 @@
});
</script>
<template>
<a-list v-model:data-source="bands" :grid="bp">
<a-list v-model:data-source="bands" :grid="{ gutter: 5, sm: 1, md: 3, lg: 4, xl: 5, xxl: 6 }">
<template #renderItem="{ item }">
<a-list-item :key="item._id + inc">
<a-row :gutter="[5, 5]">
@ -35,7 +34,7 @@
</nuxt-link>
</a-col>
<!-- subscribe... -->
<a-col v-if="data && data.user?._id" style="margin-left: auto">
<a-col v-if="data && data?.user?._id" style="margin-left: auto">
<a
v-if="!data?.user.subscriptions.bands.includes(item._id)"
@click="
@ -59,7 +58,7 @@
<icon :istyle="'regular'" name="x" :size="12" />
</a>
</a-col>
<a-col v-if="data?.user._id">
<a-col v-if="data?.user?._id">
<a
@click="
async (e) => {