unread rooms query in chat notification

This commit is contained in:
Moriz Wahl 2023-07-14 14:50:43 +02:00
parent d7746e5904
commit c46d0064fc
2 changed files with 25 additions and 1 deletions

View File

@ -8,18 +8,34 @@
placement: 'bottom-start',
}"
>
<counter-icon icon="chat-bubble" :count="1" danger />
<counter-icon icon="chat-bubble" :count="count" danger />
</base-button>
</nuxt-link>
</template>
<script>
import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon'
import { unreadRoomsQuery } from '~/graphql/Rooms'
export default {
name: 'ChatNotificationMenu',
components: {
CounterIcon,
},
data() {
return {
count: 0,
}
},
apollo: {
UnreadRooms: {
query() {
return unreadRoomsQuery()
},
update({ UnreadRooms }) {
this.count = UnreadRooms
},
},
},
}
</script>

View File

@ -27,3 +27,11 @@ export const createRoom = () => gql`
}
}
`
export const unreadRoomsQuery = () => {
return gql`
query {
UnreadRooms
}
`
}