forked from noxious/client
My 13th reason (2.0)
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Modal v-for="notification in notifications.getNotifications" :key="notification.id" :isModalOpen="true" @modal:close="closeNotification(notification.id)">
|
||||
<Modal v-for="notification in gameStore.getNotifications" :key="notification.id" :isModalOpen="true" @modal:close="closeNotification(notification.id)">
|
||||
<template #modalHeader v-if="notification.title">
|
||||
<h3 class="m-0 font-medium shrink-0">{{ notification.title }}</h3>
|
||||
</template>
|
||||
@ -10,16 +10,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useNotificationStore } from '@/stores/notifications'
|
||||
import { useGameStore } from '@/stores/game'
|
||||
import Modal from '@/components/utilities/Modal.vue'
|
||||
import { onBeforeMount, onBeforeUnmount, watch } from 'vue'
|
||||
|
||||
const notifications = useNotificationStore()
|
||||
const gameStore = useGameStore()
|
||||
|
||||
function closeNotification(id: string) {
|
||||
notifications.removeNotification(id)
|
||||
gameStore.removeNotification(id)
|
||||
}
|
||||
|
||||
type Notification = {
|
||||
@ -29,7 +27,7 @@ type Notification = {
|
||||
|
||||
function setupNotificationListener(connection: any) {
|
||||
connection.on('notification', (data: Notification) => {
|
||||
notifications.addNotification({
|
||||
gameStore.addNotification({
|
||||
title: data.title,
|
||||
message: data.message
|
||||
})
|
||||
|
Reference in New Issue
Block a user