update
This commit is contained in:
@@ -4,7 +4,7 @@ import { createGlobalState } from '@vueuse/core'
|
||||
export const useClients = createGlobalState(() => {
|
||||
const auth = useAuth()
|
||||
const signaling = useSignaling()
|
||||
const toast = useToast()
|
||||
const { emit } = useEventBus()
|
||||
|
||||
const clients = shallowRef<ChadClient[]>([])
|
||||
|
||||
@@ -16,10 +16,17 @@ export const useClients = createGlobalState(() => {
|
||||
|
||||
socket.on('clientChanged', (clientId: ChadClient['socketId'], updatedClient: UpdatedClient) => {
|
||||
const client = getClient(clientId)
|
||||
|
||||
if (!client)
|
||||
return
|
||||
|
||||
updateClient(clientId, updatedClient)
|
||||
|
||||
if (client && client.displayName !== updatedClient.displayName)
|
||||
toast.add({ severity: 'info', summary: `${client.displayName} is now ${updatedClient.displayName}`, closable: false, life: 1000 })
|
||||
emit('client:updated', {
|
||||
socketId: clientId,
|
||||
oldClient: client,
|
||||
updatedClient,
|
||||
})
|
||||
})
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
|
||||
Reference in New Issue
Block a user