init
This commit is contained in:
@@ -6,6 +6,7 @@ import {ref, watch} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import CreateChannelDialog from '@/components/channel/CreateChannelDialog.vue'
|
||||
import {type MenuItem, useContextMenu} from '@/composables/useContextMenu'
|
||||
import {useUserStore} from "@/stores/user.ts";
|
||||
|
||||
const props = defineProps<{
|
||||
serverId: string
|
||||
@@ -15,6 +16,7 @@ const props = defineProps<{
|
||||
const route = useRoute()
|
||||
const channelStore = useChannelStore()
|
||||
const categoryStore = useCategoryStore()
|
||||
const userStore = useUserStore()
|
||||
const {channels} = storeToRefs(channelStore)
|
||||
const {categories} = storeToRefs(categoryStore)
|
||||
const {openContextMenu} = useContextMenu()
|
||||
@@ -24,10 +26,12 @@ const loadServerData = async (targetServerId: string) => {
|
||||
if (!targetServerId) return
|
||||
channelStore.reset()
|
||||
categoryStore.reset()
|
||||
userStore.reset()
|
||||
try {
|
||||
await Promise.all([
|
||||
channelStore.fetchChannels(targetServerId),
|
||||
categoryStore.fetchCategories(targetServerId)
|
||||
categoryStore.fetchCategories(targetServerId),
|
||||
userStore.fetchUsers(targetServerId)
|
||||
])
|
||||
} catch (error) {
|
||||
console.error('Failed to load server-scoped channels and categories:', error)
|
||||
|
||||
Reference in New Issue
Block a user