This commit is contained in:
2026-07-27 09:37:36 +02:00
parent 70c0b649e6
commit 7b33b76b3d
6 changed files with 229 additions and 7 deletions
+28 -2
View File
@@ -1,18 +1,44 @@
<script lang="ts" setup>
import {storeToRefs} from 'pinia'
import {useChannelStore} from '@/stores/channel'
import {ref} from 'vue'
import {useCategoryStore} from '@/stores/category'
import {ref, watch, onMounted} from 'vue'
import {useRoute} from 'vue-router'
const props = defineProps<{
serverId: string
channelId?: string
}>();
const serverId = props.serverId
const route = useRoute()
const channelStore = useChannelStore()
const categoryStore = useCategoryStore()
const {channels} = storeToRefs(channelStore)
const {categories} = storeToRefs(categoryStore)
const loadServerData = async (targetServerId: string) => {
if (!targetServerId) return
channelStore.reset()
categoryStore.reset()
try {
await Promise.all([
channelStore.fetchChannels(targetServerId),
categoryStore.fetchCategories(targetServerId)
])
} catch (error) {
console.error('Failed to load server-scoped channels and categories:', error)
}
}
watch(
() => props.serverId,
async (newServerId) => {
if (newServerId) {
await loadServerData(newServerId)
}
},
{immediate: true}
)
const showDialog = ref(false)
const formData = ref({