various bug fixes

This commit is contained in:
Zoe
2023-04-21 01:25:27 -05:00
parent 3ea8167569
commit 4890d657b5
12 changed files with 137 additions and 41 deletions

View File

@@ -40,6 +40,9 @@ export const useGlobalStore = defineStore('global', {
setActiveChannel(channel: IChannel) {
this.activeChannel = channel;
},
setActiveServerType(type: 'dms' | 'servers') {
this.activeServerType = type;
},
updateServer(channelId: string, server: IServer) {
const serverIndex = this.servers.findIndex(s => s.channels.some((c) => c.id === channelId));
this.servers[serverIndex] = server;
@@ -70,6 +73,12 @@ export const useGlobalStore = defineStore('global', {
}
this.servers.push(server);
},
getServerByChannelId(channelId: string) {
let channel: IChannel | IServer | undefined = this.dms.find((e) => e.id === channelId);
if (channel) return channel;
channel = this.servers.find((e) => e.channels.some((c) => c.id === channelId));
return channel;
},
setDms(dms: Array<IChannel>) {
this.dms = dms;
},