@drax/identity-vue 0.7.2 → 0.7.3

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.7.2",
6
+ "version": "0.7.3",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -24,11 +24,11 @@
24
24
  "format": "prettier --write src/"
25
25
  },
26
26
  "dependencies": {
27
- "@drax/common-front": "^0.7.2",
28
- "@drax/common-vue": "^0.7.2",
27
+ "@drax/common-front": "^0.7.3",
28
+ "@drax/common-vue": "^0.7.3",
29
29
  "@drax/crud-front": "^0.7.0",
30
30
  "@drax/crud-share": "^0.7.0",
31
- "@drax/crud-vue": "^0.7.2",
31
+ "@drax/crud-vue": "^0.7.3",
32
32
  "@drax/identity-share": "^0.7.0"
33
33
  },
34
34
  "peerDependencies": {
@@ -66,5 +66,5 @@
66
66
  "vue-tsc": "^2.1.6",
67
67
  "vuetify": "^3.7.1"
68
68
  },
69
- "gitHead": "16cc1a89246c498860bd155c457d3c2388337352"
69
+ "gitHead": "70c45f96366ae8752cc9708856d194b6940fe2c7"
70
70
  }
@@ -1,6 +1,6 @@
1
1
  import {useAuthStore} from "../stores/auth/AuthStore";
2
- import {AuthHelper, AuthSystem} from "@drax/identity-front";
3
- import {inject} from "vue";
2
+ import {AuthHelper, AuthSystemFactory} from "@drax/identity-front";
3
+ import type {AuthSystem} from "@drax/identity-front";
4
4
  import {useRouter} from 'vue-router'
5
5
 
6
6
  export function useAuth() {
@@ -8,7 +8,7 @@ export function useAuth() {
8
8
  const authStore = useAuthStore()
9
9
  const router = useRouter()
10
10
 
11
- const authSystem = inject('AuthSystem') as AuthSystem
11
+ const authSystem: AuthSystem = AuthSystemFactory.getInstance()
12
12
 
13
13
  const login = async (username: string, password: string) => {
14
14
  const {accessToken} = await authSystem.login(username, password)
@@ -22,7 +22,7 @@ export function useAuth() {
22
22
  }
23
23
 
24
24
  const changeAvatar = async (file: File) => {
25
- if(file){
25
+ if (file) {
26
26
  await authSystem.changeAvatar(file)
27
27
  await fetchAuthUser()
28
28
  return
@@ -1,13 +1,14 @@
1
- import {inject, ref} from "vue";
2
- import {RoleSystem} from "@drax/identity-front";
1
+ import {ref} from "vue";
2
+ import type {RoleSystem} from "@drax/identity-front";
3
+ import {RoleSystemFactory} from "@drax/identity-front";
3
4
  import type {IRole, IRoleBase} from "@drax/identity-share";
4
5
  import {ClientError} from "@drax/common-front";
5
- import type { IClientInputError} from "@drax/common-front";
6
+ import type {IClientInputError} from "@drax/common-front";
6
7
 
7
8
 
8
9
  export function useRole() {
9
10
 
10
- const roleSystem = inject('RoleSystem') as RoleSystem
11
+ const roleSystem: RoleSystem = RoleSystemFactory.getInstance()
11
12
 
12
13
  let roleError = ref<string>('')
13
14
  let inputErrors = ref<IClientInputError>()
@@ -27,7 +28,7 @@ export function useRole() {
27
28
  return roles
28
29
  }
29
30
 
30
- async function paginateRole({page= 1, limit= 5, orderBy="", order=false, search = ""}) {
31
+ async function paginateRole({page = 1, limit = 5, orderBy = "", order = false, search = ""}) {
31
32
  loading.value = true
32
33
  let paginatedrole = roleSystem.paginate({page, limit, orderBy, order, search})
33
34
  loading.value = false
@@ -37,16 +38,17 @@ export function useRole() {
37
38
  async function createRole(roleData: IRoleBase) {
38
39
  try {
39
40
  loading.value = true
40
- let role: IRole = await roleSystem.create(roleData)
41
+ let role: IRole = await roleSystem.create(roleData)
41
42
  return role
42
43
  } catch (err) {
43
44
  if (err instanceof ClientError) {
44
45
  inputErrors.value = err.inputErrors
45
- }if(err instanceof Error) {
46
+ }
47
+ if (err instanceof Error) {
46
48
  roleError.value = err.message
47
49
  }
48
50
  throw err
49
- }finally {
51
+ } finally {
50
52
  loading.value = false
51
53
  }
52
54
 
@@ -62,11 +64,11 @@ export function useRole() {
62
64
  if (err instanceof ClientError) {
63
65
  inputErrors.value = err.inputErrors
64
66
  }
65
- if(err instanceof Error) {
67
+ if (err instanceof Error) {
66
68
  roleError.value = err.message
67
69
  }
68
70
  throw err
69
- }finally {
71
+ } finally {
70
72
  loading.value = false
71
73
  }
72
74
  }
@@ -76,19 +78,29 @@ export function useRole() {
76
78
  loading.value = true
77
79
  await roleSystem.delete(id)
78
80
  } catch (err) {
79
- console.log("composable delete error: ", err, )
81
+ console.log("composable delete error: ", err,)
80
82
  if (err instanceof ClientError) {
81
83
  inputErrors.value = err.inputErrors
82
84
  }
83
- if(err instanceof Error) {
85
+ if (err instanceof Error) {
84
86
  roleError.value = err.message
85
87
  }
86
88
  throw err
87
- }finally {
89
+ } finally {
88
90
  loading.value = false
89
91
  }
90
92
  }
91
93
 
92
- return {fetchRole, fetchPermissions, paginateRole, createRole, editRole, deleteRole, loading, roleError, inputErrors}
94
+ return {
95
+ fetchRole,
96
+ fetchPermissions,
97
+ paginateRole,
98
+ createRole,
99
+ editRole,
100
+ deleteRole,
101
+ loading,
102
+ roleError,
103
+ inputErrors
104
+ }
93
105
 
94
106
  }
@@ -1,13 +1,14 @@
1
- import {inject, ref} from "vue";
1
+ import {ref} from "vue";
2
2
  import type {ITenant, ITenantBase} from "@drax/identity-share";
3
3
  import type { TenantSystem} from "@drax/identity-front";
4
+ import { TenantSystemFactory} from "@drax/identity-front";
4
5
  import {ClientError} from "@drax/common-front";
5
6
  import type { IClientInputError} from "@drax/common-front";
6
7
 
7
8
 
8
9
  export function useTenant() {
9
10
 
10
- const tenantSystem = inject('TenantSystem') as TenantSystem
11
+ const tenantSystem : TenantSystem = TenantSystemFactory.getInstance()
11
12
 
12
13
  let tenantError = ref<string>('')
13
14
  let inputErrors = ref<IClientInputError>()
@@ -1,5 +1,6 @@
1
1
  import {inject, ref} from "vue";
2
2
  import type {UserSystem} from "@drax/identity-front";
3
+ import {UserSystemFactory} from "@drax/identity-front";
3
4
  import type {IClientInputError} from "@drax/common-front";
4
5
  import {ClientError} from "@drax/common-front";
5
6
  import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
@@ -7,7 +8,7 @@ import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
7
8
 
8
9
  export function useUser() {
9
10
 
10
- const userSystem = inject('UserSystem') as UserSystem
11
+ const userSystem: UserSystem = UserSystemFactory.getInstance()
11
12
 
12
13
  let userError = ref<string>('')
13
14
  let inputErrors = ref<IClientInputError>()
@@ -1,13 +1,13 @@
1
- import {inject, ref} from "vue";
1
+ import {ref} from "vue";
2
2
  import type {IUserApiKey, IUserApiKeyBase} from "@drax/identity-share";
3
- import type { UserApiKeySystem} from "@drax/identity-front";
3
+ import { UserApiKeySystemFactory} from "@drax/identity-front";
4
4
  import {ClientError} from "@drax/common-front";
5
5
  import type { IClientInputError} from "@drax/common-front";
6
6
 
7
7
 
8
8
  export function useUserApiKey() {
9
9
 
10
- const userApiKeySystem = inject('UserApiKeySystem') as UserApiKeySystem
10
+ const userApiKeySystem = UserApiKeySystemFactory.getInstance()
11
11
 
12
12
  let userApiKeyError = ref<string>('')
13
13
  let inputErrors = ref<IClientInputError>()