🎨 Deconstruct the snackbar

This commit is contained in:
2024-04-04 18:35:48 +08:00
parent 49bd6ea363
commit 9bc387cb86
27 changed files with 138 additions and 165 deletions

View File

@@ -15,9 +15,6 @@
</v-app-bar>
<router-view />
<!-- @vue-ignore -->
<v-snackbar v-model="error" :timeout="5000">Something went wrong... {{ error }}</v-snackbar>
</template>
<script setup lang="ts">
@@ -26,20 +23,21 @@ import { useRoute } from "vue-router"
import { onMounted, ref, watch } from "vue"
import { useChannels } from "@/stores/channels"
import ChannelAction from "@/components/chat/channels/ChannelAction.vue"
import { useUI } from "@/stores/ui"
const { showErrorSnackbar } = useUI()
const route = useRoute()
const channels = useChannels()
const error = ref<string | null>(null)
const loading = ref(false)
async function readMetadata() {
loading.value = true
const res = await request("messaging", `/api/channels/${route.params.channel}`)
if (res.status !== 200) {
error.value = await res.text()
showErrorSnackbar(await res.text())
} else {
error.value = null
channels.current = await res.json()
}
loading.value = false

View File

@@ -108,7 +108,7 @@ import { useUserinfo, signout as signoutAccount } from "@/stores/userinfo"
import { useWellKnown } from "@/stores/wellKnown"
import { useUI } from "@/stores/ui"
import RealmList from "@/components/realms/RealmList.vue"
import NotificationList from "@/components/NotificationList.vue"
import NotificationList from "@/components/users/NotificationList.vue"
import ChannelList from "@/components/chat/channels/ChannelList.vue"
const ui = useUI()