Invite accounts

This commit is contained in:
2024-03-23 16:23:21 +08:00
parent 311700db04
commit 327941455e
26 changed files with 326 additions and 143 deletions

View File

@ -1,6 +1,7 @@
import { reactive, ref } from "vue"
import { defineStore } from "pinia"
import { checkLoggedIn, getAtk } from "@/stores/userinfo"
import { request } from "@/scripts/request"
export const useRealms = defineStore("realms", () => {
const done = ref(false)
@ -20,7 +21,7 @@ export const useRealms = defineStore("realms", () => {
async function list() {
if (!checkLoggedIn()) return
const res = await fetch("/api/realms/me/available", {
const res = await request("/api/realms/me/available", {
headers: { Authorization: `Bearer ${getAtk()}` }
})
if (res.status !== 200) {

View File

@ -31,25 +31,25 @@ export const useUserinfo = defineStore("userinfo", () => {
async function readProfiles() {
if (!checkLoggedIn()) {
isReady.value = true;
}
const res = await request("/api/users/me", {
headers: { "Authorization": `Bearer ${getAtk()}` }
});
if (res.status !== 200) {
return;
}
const data = await res.json();
userinfo.value = {
isReady: true,
isLoggedIn: true,
displayName: data["nick"],
data: data
};
isReady.value = true
}
const res = await request("/api/users/me", {
headers: { Authorization: `Bearer ${getAtk()}` }
})
if (res.status !== 200) {
return
}
const data = await res.json()
userinfo.value = {
isReady: true,
isLoggedIn: true,
displayName: data["nick"],
data: data
}
}
return { userinfo, isReady, readProfiles }