接入群成员与邀请实时同步
This commit is contained in:
1 parent
b2e04e8174
commit
5cae19a256
9 files changed
+175
-38
No files matched your search
+3
-1
@@ -27,6 +27,7 @@ export const useSession = defineStore('session', () => {
|
||||
const contactChanges = ref(0)
|
||||
const inboxChanges = ref(0)
|
||||
const groupChange = shallowRef<{ groupId: string }>()
|
||||
const groupListChanges = ref(0)
|
||||
let token = ''
|
||||
let socket: WebSocket | undefined
|
||||
let retry: ReturnType<typeof setTimeout> | undefined
|
||||
@@ -61,6 +62,7 @@ export const useSession = defineStore('session', () => {
|
||||
if (type === 'contacts_changed') contactChanges.value++
|
||||
if (type === 'inbox_changed') inboxChanges.value++
|
||||
if (type === 'group_changed' && typeof groupId === 'string') groupChange.value = { groupId }
|
||||
if (type === 'group_list_changed') groupListChanges.value++
|
||||
}
|
||||
active.onclose = (event) => {
|
||||
if (socket !== active) return
|
||||
@@ -112,7 +114,7 @@ export const useSession = defineStore('session', () => {
|
||||
}
|
||||
|
||||
return {
|
||||
identity, connection, contactChanges, inboxChanges, groupChange, authenticate, logout, authorized,
|
||||
identity, connection, contactChanges, inboxChanges, groupChange, groupListChanges, authenticate, logout, authorized,
|
||||
devices: () => authorized<Device[]>('/devices'),
|
||||
revoke: (id: string) => authorized<void>('/devices/' + encodeURIComponent(id), 'DELETE'),
|
||||
contacts: () => authorized<Contact[]>('/contacts'),
|
||||
|
||||
Reference in new issue
Block a user