stream day 5

This commit is contained in:
Zoe
2023-01-10 19:19:37 -06:00
parent 1cb01289bc
commit 880d1bf375
21 changed files with 315 additions and 158 deletions

29
stores/store.ts Normal file
View File

@@ -0,0 +1,29 @@
export const useGlobalStore = defineStore('global', {
state: () => ({
activeServer: {},
user: {}
}),
actions: {
setUser(user) {
this.user = user;
},
addServer(server) {
if (this.user.servers.find((e) => e.id === server.id)) return;
this.user.servers.push(server)
},
addDM(dmChannel) {
if (this.user.channels.includes(dmChannel)) return;
this.user.channels.push(dmChannel)
},
setActive(type, serverId) {
if (serverId === '@me') {
this.activeServer = {}
return;
}
type = (type === 'dm') ? 'channels' : 'servers'
this.activeServer = this["user"][type].find((e) => e.id === serverId)
},
},
})