@truedat/auth 7.5.13 → 7.6.0
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 +4 -5
- package/src/hooks/useUsers.js +18 -2
- package/src/users/api.js +9 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/auth",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Truedat Web Auth",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.
|
|
51
|
+
"@truedat/test": "7.6.0",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@apollo/client": "^3.13.8",
|
|
58
|
-
"@truedat/core": "7.
|
|
58
|
+
"@truedat/core": "7.6.0",
|
|
59
59
|
"auth0-js": "^9.28.0",
|
|
60
60
|
"axios": "^1.9.0",
|
|
61
61
|
"graphql": "^16.11.0",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"redux-saga": "^1.3.0",
|
|
81
81
|
"redux-saga-routines": "^3.2.3",
|
|
82
82
|
"reselect": "^5.1.1",
|
|
83
|
-
"semantic-ui-calendar-react": "^0.15.3",
|
|
84
83
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
85
84
|
"swr": "^2.3.3",
|
|
86
85
|
"validator": "^13.15.0"
|
|
@@ -92,5 +91,5 @@
|
|
|
92
91
|
"resolutions": {
|
|
93
92
|
"superagent@npm:^7.1.5": "10.2.1"
|
|
94
93
|
},
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "0d9c5ee7b864fe3dc87def2be0f68191c04dee57"
|
|
96
95
|
}
|
package/src/hooks/useUsers.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import useSWRMutation from "swr/mutation";
|
|
3
|
+
import { apiJson, apiJsonPost } from "@truedat/core/services/api";
|
|
4
|
+
import { API_AGENTS, API_GRANT_RESQUESTABLE_USERS } from "../users/api";
|
|
4
5
|
|
|
5
6
|
export const useAgents = () => {
|
|
6
7
|
const { data, error } = useSWR(API_AGENTS, apiJson);
|
|
7
8
|
return { agents: data?.data?.data, error, loading: !error && !data };
|
|
8
9
|
};
|
|
10
|
+
|
|
11
|
+
export const useGrantRequestableUsers = () => {
|
|
12
|
+
const { data, error, trigger, isMutating } = useSWRMutation(
|
|
13
|
+
API_GRANT_RESQUESTABLE_USERS,
|
|
14
|
+
(url, { arg }) => apiJsonPost(url, arg)
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
users: data?.data?.data,
|
|
19
|
+
trigger,
|
|
20
|
+
isMutating,
|
|
21
|
+
error,
|
|
22
|
+
loading: !error && !data,
|
|
23
|
+
};
|
|
24
|
+
};
|
package/src/users/api.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
const API_AGENTS = "/api/users/agents";
|
|
2
|
+
const API_CAN_INIT = "/api/init/can";
|
|
3
|
+
const API_GRANT_RESQUESTABLE_USERS = "/api/users/grant_requestable";
|
|
4
|
+
const API_INIT = "/api/init";
|
|
2
5
|
const API_USER = "/api/users/:id";
|
|
3
|
-
const API_USERS = "/api/users";
|
|
4
6
|
const API_USER_CHANGE_PASSWORD = "/api/password";
|
|
7
|
+
const API_USERS = "/api/users";
|
|
5
8
|
const API_USERS_SEARCH = "/api/users/search";
|
|
6
|
-
const API_INIT = "/api/init";
|
|
7
|
-
const API_CAN_INIT = "/api/init/can";
|
|
8
9
|
|
|
9
10
|
export {
|
|
10
11
|
API_AGENTS,
|
|
12
|
+
API_CAN_INIT,
|
|
13
|
+
API_GRANT_RESQUESTABLE_USERS,
|
|
14
|
+
API_INIT,
|
|
15
|
+
API_USER_CHANGE_PASSWORD,
|
|
11
16
|
API_USER,
|
|
12
|
-
API_USERS,
|
|
13
17
|
API_USERS_SEARCH,
|
|
14
|
-
|
|
15
|
-
API_INIT,
|
|
16
|
-
API_CAN_INIT,
|
|
18
|
+
API_USERS,
|
|
17
19
|
};
|