From 12cbb670df71573a18beb2a3c348297ec42cd7dc Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 19 Mar 2024 22:54:21 +0800 Subject: [PATCH] :bug: Fix code in wrong place --- pkg/views/src/components/realms/RealmDeletion.vue | 6 ++++++ pkg/views/src/components/realms/RealmEditor.vue | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/views/src/components/realms/RealmDeletion.vue b/pkg/views/src/components/realms/RealmDeletion.vue index f2c701e..ee4cc32 100644 --- a/pkg/views/src/components/realms/RealmDeletion.vue +++ b/pkg/views/src/components/realms/RealmDeletion.vue @@ -23,7 +23,10 @@ import { useRealms } from "@/stores/realms" import { getAtk } from "@/stores/userinfo" import { ref } from "vue" +import { useRoute, useRouter } from "vue-router" +const route = useRoute() +const router = useRouter() const realms = useRealms() const emits = defineEmits(["relist"]) @@ -48,6 +51,9 @@ async function deletePost() { realms.show.delete = false realms.related.delete_to = null emits("relist") + if (route.name?.toString()?.startsWith("realm")) { + router.push({ name: "explore" }) + } } loading.value = false } diff --git a/pkg/views/src/components/realms/RealmEditor.vue b/pkg/views/src/components/realms/RealmEditor.vue index ed7540a..2a60f6a 100644 --- a/pkg/views/src/components/realms/RealmEditor.vue +++ b/pkg/views/src/components/realms/RealmEditor.vue @@ -31,10 +31,7 @@ import { ref, watch } from "vue" import { getAtk } from "@/stores/userinfo" import { useRealms } from "@/stores/realms" -import { useRoute, useRouter } from "vue-router" -const route = useRoute() -const router = useRouter() const emits = defineEmits(["relist"]) const realms = useRealms() @@ -76,10 +73,6 @@ async function submit(evt: SubmitEvent) { realms.done = true realms.show.editor = false realms.related.edit_to = null - - if (route.name?.toString()?.startsWith("realm")) { - router.push({ name: "explore" }) - } } loading.value = false }