@goweekdays/layer-common 1.2.3 → 1.2.5

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.
package/plugins/API.ts CHANGED
@@ -48,7 +48,7 @@ export default defineNuxtPlugin(() => {
48
48
  return useFetch(path, options);
49
49
  };
50
50
 
51
- // Expose to useNuxtApp().$api
51
+ // Expose to $fetch
52
52
  return {
53
53
  provide: {
54
54
  api,
@@ -1,10 +1,10 @@
1
1
  export default defineNuxtPlugin(() => {
2
2
  const router = useRouter();
3
3
  const { getByUserType } = useMember();
4
- const { getRoleById } = useRole();
4
+ const { getById: getRoleById } = useRole();
5
5
  const { membership, permissions } = useLocalAuth();
6
6
 
7
- router.afterEach((to) => {
7
+ router.afterEach(async (to) => {
8
8
  const isSecured = to.meta?.member;
9
9
  if (!isSecured) return;
10
10
 
@@ -17,7 +17,7 @@ export default defineNuxtPlugin(() => {
17
17
  data: userMemberData,
18
18
  error: userMemberError,
19
19
  refresh: refreshUserMemberData,
20
- } = useLazyAsyncData(
20
+ } = await useLazyAsyncData(
21
21
  "plugin-get-member-by-id" + userId,
22
22
  () => getByUserType(userId, APP, org),
23
23
  { immediate: false }
@@ -43,7 +43,7 @@ export default defineNuxtPlugin(() => {
43
43
 
44
44
  const roleId = computed(() => membership.value?.role ?? "");
45
45
 
46
- const { data: roleData, refresh: refreshRoleData } = useLazyAsyncData(
46
+ const { data: roleData, refresh: refreshRoleData } = await useLazyAsyncData(
47
47
  "plugin-get-role-by-id" + roleId.value,
48
48
  () => getRoleById(roleId.value),
49
49
  { immediate: false }
@@ -3,7 +3,7 @@ export default defineNuxtPlugin(() => {
3
3
  const { cookieConfig } = useRuntimeConfig().public;
4
4
  const { currentUser } = useLocalAuth();
5
5
 
6
- router.afterEach((to) => {
6
+ router.afterEach(async (to) => {
7
7
  const isSecured = to.meta?.secured;
8
8
  if (!isSecured) return;
9
9
 
@@ -14,8 +14,8 @@ export default defineNuxtPlugin(() => {
14
14
  }
15
15
 
16
16
  const { data: getCurrentUserReq, error: getCurrentUserErr } =
17
- useLazyAsyncData("get-current-user", () =>
18
- useNuxtApp().$api<TUser>(`/api/users/id/${user}`)
17
+ await useLazyAsyncData("get-current-user", () =>
18
+ $fetch<TUser>(`/api/users/id/${user}`)
19
19
  );
20
20
 
21
21
  watchEffect(() => {
package/types/local.d.ts CHANGED
@@ -34,3 +34,9 @@ declare type TApp = {
34
34
  updatedAt?: string | Date;
35
35
  deletedAt?: string | Date;
36
36
  };
37
+
38
+ declare type TListGroup = {
39
+ title: string;
40
+ key: string;
41
+ children: { title: string; key: string; description: string }[];
42
+ };
@@ -16,9 +16,11 @@ declare type TPermissions = {
16
16
  declare type TPerm = {
17
17
  _id?: string;
18
18
  app: string;
19
+ name: string;
19
20
  key: string;
20
21
  group: string;
21
22
  description: string;
23
+ status?: string;
22
24
  createdAt?: string | Date;
23
25
  updatedAt?: string | Date;
24
26
  deletedAt?: string | Date;
package/types/role.d.ts CHANGED
@@ -4,6 +4,7 @@ declare type TRole = {
4
4
  permissions?: Array<string>;
5
5
  type?: string;
6
6
  org?: string;
7
+ description?: string;
7
8
  status?: string;
8
9
  default?: boolean;
9
10
  createdBy?: string;