@huyooo/ui 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ import { ref as a, computed as i } from "vue";
2
+ import { g as f } from "./apiClients-Ctcq8NZs.js";
3
+ import { u as r } from "./useAuthkitAuth-BPTZUSkM.js";
4
+ const e = a(null), o = a(!1), n = a(!1), v = i(() => !!e.value), d = i(() => {
5
+ const {
6
+ getToken: u
7
+ } = r();
8
+ return u() && !n.value ? "pending" : e.value ? "authenticated" : "unauthenticated";
9
+ });
10
+ async function h() {
11
+ const {
12
+ getToken: u,
13
+ clearAuth: l
14
+ } = r();
15
+ if (!u()) {
16
+ console.warn("No authentication token found"), e.value = null, n.value = !0;
17
+ return;
18
+ }
19
+ o.value = !0, n.value = !1;
20
+ const {
21
+ data: s,
22
+ error: t
23
+ } = await f().auth.users.profile.post({});
24
+ if (o.value = !1, n.value = !0, s) {
25
+ const c = s;
26
+ e.value = c;
27
+ } else ((t == null ? void 0 : t.code) === 401 || (t == null ? void 0 : t.code) === 40101) && (e.value = null, console.warn("认证已过期,清除认证状态"), l());
28
+ }
29
+ function p() {
30
+ e.value = null, n.value = !0;
31
+ }
32
+ function P() {
33
+ return {
34
+ userProfile: e,
35
+ loading: o,
36
+ usersProfileReady: n,
37
+ isLoggedIn: v,
38
+ authSessionState: d,
39
+ fetchUserProfile: h,
40
+ clearUserProfile: p
41
+ };
42
+ }
43
+ export {
44
+ P as u
45
+ };
@@ -1,7 +1,7 @@
1
1
  import { ref as I, computed as w, watch as S } from "vue";
2
2
  import { useRouter as M, useRoute as T } from "vue-router";
3
3
  import { u as k } from "./useAuthkitAppsAuthPageInfo-DZ1p-P3Q.js";
4
- import { u as L } from "./useAuthkitUsersProfile-CW_exa7E.js";
4
+ import { u as L } from "./useAuthkitUsersProfile-BclJWOvR.js";
5
5
  const y = I({
6
6
  key: "",
7
7
  name: ""
package/dist/user.js CHANGED
@@ -1,4 +1,4 @@
1
- import { U as a, a as n, b as r, c as t, d as U, _ as u, e as i, f as M, g as o, h as m, i as I, j as c, k as d, l as b, m as f } from "./UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-DqgwJ7r3.js";
1
+ import { U as a, a as n, b as r, c as t, d as U, _ as u, e as i, f as M, g as o, h as m, i as I, j as c, k as d, l as b, m as f } from "./UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-V5EzZMCL.js";
2
2
  export {
3
3
  a as UserAccountMenu,
4
4
  n as UserAvatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -1,39 +0,0 @@
1
- import { ref as l, computed as r } from "vue";
2
- import { g as f } from "./apiClients-Ctcq8NZs.js";
3
- import { u as c } from "./useAuthkitAuth-BPTZUSkM.js";
4
- const t = l(null), u = l(!1), o = l(!1), v = r(() => !!t.value);
5
- async function p() {
6
- const {
7
- getToken: s,
8
- clearAuth: a
9
- } = c();
10
- if (!s()) {
11
- console.warn("No authentication token found"), t.value = null, o.value = !0;
12
- return;
13
- }
14
- u.value = !0, o.value = !1;
15
- const {
16
- data: n,
17
- error: e
18
- } = await f().auth.users.profile.post({});
19
- if (u.value = !1, o.value = !0, n) {
20
- const i = n;
21
- t.value = i;
22
- } else ((e == null ? void 0 : e.code) === 401 || (e == null ? void 0 : e.code) === 40101) && (t.value = null, console.warn("认证已过期,清除认证状态"), a());
23
- }
24
- function d() {
25
- t.value = null, o.value = !0;
26
- }
27
- function A() {
28
- return {
29
- userProfile: t,
30
- loading: u,
31
- usersProfileReady: o,
32
- isLoggedIn: v,
33
- fetchUserProfile: p,
34
- clearUserProfile: d
35
- };
36
- }
37
- export {
38
- A as u
39
- };