diff --git a/pkg/views/src/components/realms/RealmDeletion.vue b/pkg/views/src/components/realms/RealmDeletion.vue
new file mode 100644
index 0000000..f2c701e
--- /dev/null
+++ b/pkg/views/src/components/realms/RealmDeletion.vue
@@ -0,0 +1,54 @@
+
+
+
+ You are deleting a realm
+ {{ realms.related.delete_to?.name }}
+ All posts belonging to this domain will be deleted and never appear again. Are you confirm?
+
+
+
+ Not really
+ Yes
+
+
+
+
+ The realm has been deleted.
+
+
+ Something went wrong... {{ error }}
+
+
+
diff --git a/pkg/views/src/components/realms/RealmEditor.vue b/pkg/views/src/components/realms/RealmEditor.vue
index b46ff7a..ed7540a 100644
--- a/pkg/views/src/components/realms/RealmEditor.vue
+++ b/pkg/views/src/components/realms/RealmEditor.vue
@@ -31,7 +31,10 @@
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()
@@ -56,8 +59,8 @@ async function submit(evt: SubmitEvent) {
const payload = data.value
if (!payload.name) return
- const url = realms.related.edit_to ? `/api/realms/${realms.related.edit_to?.id}` : "/api/moments";
- const method = realms.related.edit_to ? "PUT" : "POST";
+ const url = realms.related.edit_to ? `/api/realms/${realms.related.edit_to?.id}` : "/api/realms"
+ const method = realms.related.edit_to ? "PUT" : "POST"
loading.value = true
const res = await fetch(url, {
@@ -72,6 +75,11 @@ async function submit(evt: SubmitEvent) {
form.reset()
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
}
diff --git a/pkg/views/src/components/realms/RealmTools.vue b/pkg/views/src/components/realms/RealmTools.vue
index ceb8332..126ec29 100644
--- a/pkg/views/src/components/realms/RealmTools.vue
+++ b/pkg/views/src/components/realms/RealmTools.vue
@@ -2,11 +2,15 @@
+
+
+
diff --git a/pkg/views/src/views/realms/page.vue b/pkg/views/src/views/realms/page.vue
index 9e22e90..3d1dad3 100644
--- a/pkg/views/src/views/realms/page.vue
+++ b/pkg/views/src/views/realms/page.vue
@@ -95,8 +95,15 @@ async function readMore({ done }: any) {
}
}
-readMetadata()
-readPosts()
+watch(
+ () => route.params.realmId,
+ () => {
+ posts.value = []
+ readMetadata()
+ readPosts()
+ },
+ { immediate: true }
+)
watch(realms, (val) => {
if (val.done) {