typing indicator, mentions + bug fixes

This commit is contained in:
Zoe
2023-01-14 06:37:13 -06:00
parent c39da0678d
commit f1c5537697
23 changed files with 629 additions and 190 deletions

View File

@@ -1,3 +1,4 @@
import { Socket } from "socket.io-client";
import { SafeUser, IServer, IChannel } from "../types";
export const useGlobalStore = defineStore('global', {
@@ -6,7 +7,8 @@ export const useGlobalStore = defineStore('global', {
activeServerType: '' as "dms" | "servers" | undefined,
user: {} as SafeUser,
dms: [] as IChannel[],
servers: [] as IServer[]
servers: [] as IServer[],
socket: null as unknown
}),
actions: {
setUser(user: SafeUser) {
@@ -26,6 +28,9 @@ export const useGlobalStore = defineStore('global', {
setDms(dms: Array<IChannel>) {
this.dms = dms
},
setSocket(socket: Socket) {
this.socket = socket
},
setActive(type: "servers" | "dms", channelId: string) {
if (channelId === '@me') {
this.activeServer = {} as IServer | IChannel
@@ -50,5 +55,11 @@ export const useGlobalStore = defineStore('global', {
this.activeServer = this.servers[activeServerIndex]
},
logout() {
this.dms = []
this.servers = []
this.socket = null
this.activeServer = {} as IServer | IChannel
}
},
})