More places will show menu

This commit is contained in:
2024-03-19 20:35:05 +08:00
parent b1518f030b
commit 2f87f9bc32
17 changed files with 184 additions and 272 deletions

View File

@ -1,16 +1,16 @@
import { defineStore } from "pinia";
import { reactive, ref } from "vue";
import { checkLoggedIn, getAtk } from "@/stores/userinfo";
import { defineStore } from "pinia"
import { reactive, ref } from "vue"
import { checkLoggedIn, getAtk } from "@/stores/userinfo"
export const useEditor = defineStore("editor", () => {
const done = ref(false);
const done = ref(false)
const show = reactive({
moment: false,
article: false,
comment: false,
delete: false
});
})
const related = reactive<{
edit_to: any
@ -24,24 +24,24 @@ export const useEditor = defineStore("editor", () => {
reply_to: null,
repost_to: null,
delete_to: null
});
})
const availableRealms = ref<any[]>([]);
const availableRealms = ref<any[]>([])
async function listRealms() {
if (!checkLoggedIn()) return;
if (!checkLoggedIn()) return
const res = await fetch("/api/realms/me/available", {
headers: { Authorization: `Bearer ${getAtk()}` }
});
})
if (res.status !== 200) {
throw new Error(await res.text());
throw new Error(await res.text())
} else {
availableRealms.value = await res.json();
availableRealms.value = await res.json()
}
}
listRealms().then(() => console.log("[STARTUP HOOK] Fetch available realm successes."));
listRealms().then(() => console.log("[STARTUP HOOK] Fetch available realm successes."))
return { show, related, availableRealms, listRealms, done };
});
return { show, related, availableRealms, listRealms, done }
})