diff --git a/components/modals/GroupChatModal.vue b/components/modals/GroupChatModal.vue index 312a784..081acde 100644 --- a/components/modals/GroupChatModal.vue +++ b/components/modals/GroupChatModal.vue @@ -21,6 +21,7 @@ const name = ref(); const members = ref([]); const options = computed(() => { + if (!users) return []; return users.map((user) => ({ value: user.id, label: user.name, diff --git a/composables/useOtherUser.ts b/composables/useOtherUser.ts index 48d1116..83cbb7c 100644 --- a/composables/useOtherUser.ts +++ b/composables/useOtherUser.ts @@ -5,6 +5,7 @@ import { type User } from "@prisma/client"; export const useOtherUser = (conversation: FullConversationType | { users: User[] }, session: any) => { const otherUser = computed(() => { + if (!conversation) return null; const currentUserEmail = session?.value?.user?.email; const otherUser = conversation.users.filter((user) => user.email !== currentUserEmail);