This commit is contained in:
2024-12-12 15:29:22 +08:00
parent 208ffec6dc
commit c3356b6d39
17 changed files with 21 additions and 23 deletions

View File

@@ -872,14 +872,12 @@ const se = class se {
const { iat: r } = JSON.parse(window.atob((n = a == null ? void 0 : a.split(".")) == null ? void 0 : n[1])), { iat: s, ...i } = F.decode(window.localStorage.getItem(ot) || "", {});
return s === r ? Promise.resolve(i) : F.get("/api/mine-info").then(({ User: o = null }) => (window.localStorage.setItem(ot, F.encode({ ...o, iat: r })), o));
} catch (a) {
console.error(a), t && K.error("请登录").then(logout);
console.error(a), t && K.error("请登录").then(this.logout);
}
return Promise.resolve(null);
});
v(this, "login", (t, n, a = {}) => F.post("/api/user-token", { username: t, passwd: Un.hash(n), platform: "web", ...a }).then(({ token: r }) => (window.localStorage.setItem(_e, r), r)));
v(this, "logout", () => {
window.localStorage.removeItem(ot), window.localStorage.removeItem(_e);
});
v(this, "logout", (t) => (window.localStorage.removeItem(ot), window.localStorage.removeItem(_e), t == null ? void 0 : t()));
if (p(se, ye)) return p(se, ye);
}
};