0.4.41
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user