Messages update & deletion

This commit is contained in:
2024-03-31 20:35:36 +08:00
parent fc1aef6eb7
commit 09154f1359
10 changed files with 209 additions and 27 deletions

View File

@@ -8,7 +8,7 @@
<template #actions>
<div class="w-full flex justify-end">
<v-btn color="grey-darken-3" @click="channels.show.delete = false">Not really</v-btn>
<v-btn color="error" :disabled="loading" @click="deletePost">Yes</v-btn>
<v-btn color="error" :disabled="loading" @click="deleteChannel">Yes</v-btn>
</div>
</template>
</v-card>
@@ -36,7 +36,7 @@ const error = ref<string | null>(null)
const success = ref(false)
const loading = ref(false)
async function deletePost() {
async function deleteChannel() {
const target = channels.related.delete_to
const url = `/api/channels/${target.id}`
@@ -52,8 +52,8 @@ async function deletePost() {
channels.show.delete = false
channels.related.delete_to = null
emits("relist")
if (route.name?.toString()?.startsWith("realm")) {
router.push({ name: "explore" })
if (route.name?.toString()?.includes("channel")) {
await router.push({ name: "explore" })
}
}
loading.value = false

View File

@@ -8,6 +8,10 @@
<v-bottom-sheet class="max-w-[480px]" v-model="channels.show.delete">
<channel-deletion @relist="channels.list" />
</v-bottom-sheet>
<v-bottom-sheet class="max-w-[480px]" v-model="channels.show.messages.delete">
<message-deletion />
</v-bottom-sheet>
</template>
<script setup lang="ts">
@@ -15,6 +19,7 @@ import { useChannels } from "@/stores/channels"
import ChannelEditor from "@/components/chat/channels/ChannelEditor.vue"
import ChannelMembers from "@/components/chat/channels/ChannelMembers.vue"
import ChannelDeletion from "@/components/chat/channels/ChannelDeletion.vue"
import MessageDeletion from "@/components/chat/MessageDeletion.vue"
const channels = useChannels()
</script>