@openmrs/esm-react-utils 3.2.1-pre.1104 → 3.2.1-pre.1111
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/dist/openmrs-esm-react-utils.js +1 -1
- package/dist/openmrs-esm-react-utils.js.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +7 -7
- package/src/useSessionUser.tsx +13 -13
- package/webpack.config.js +1 -1
- package/.babelrc +0 -8
- package/babel.config.js +0 -3
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-react-utils",
|
|
3
|
-
"version": "3.2.1-pre.
|
|
3
|
+
"version": "3.2.1-pre.1111",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "React utilities for OpenMRS.",
|
|
6
6
|
"browser": "dist/openmrs-esm-react-utils.js",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"react-i18next": "11.x"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@openmrs/esm-api": "^3.2.1-pre.
|
|
59
|
-
"@openmrs/esm-config": "^3.2.1-pre.
|
|
60
|
-
"@openmrs/esm-error-handling": "^3.2.1-pre.
|
|
61
|
-
"@openmrs/esm-extensions": "^3.2.1-pre.
|
|
62
|
-
"@openmrs/esm-globals": "^3.2.1-pre.
|
|
58
|
+
"@openmrs/esm-api": "^3.2.1-pre.1111",
|
|
59
|
+
"@openmrs/esm-config": "^3.2.1-pre.1111",
|
|
60
|
+
"@openmrs/esm-error-handling": "^3.2.1-pre.1111",
|
|
61
|
+
"@openmrs/esm-extensions": "^3.2.1-pre.1111",
|
|
62
|
+
"@openmrs/esm-globals": "^3.2.1-pre.1111",
|
|
63
63
|
"dayjs": "^1.10.8",
|
|
64
64
|
"i18next": "^19.6.0",
|
|
65
65
|
"react": "^16.13.1",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"rxjs": "^6.5.3",
|
|
69
69
|
"unistore": "^3.5.2"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "811783b51250ea3f1e50e04e4139bb3362ddfb1a"
|
|
72
72
|
}
|
package/src/useSessionUser.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/** @module @category API */
|
|
2
|
-
import {
|
|
2
|
+
import { getCurrentUser, Session } from "@openmrs/esm-api";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
const [
|
|
5
|
+
export function useSession() {
|
|
6
|
+
const [session, setSession] = useState<Session | null>(null);
|
|
7
7
|
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
setSessionUser(user.data);
|
|
13
|
-
}
|
|
14
|
-
);
|
|
9
|
+
const sub = getCurrentUser({ includeAuthStatus: true }).subscribe(
|
|
10
|
+
(session) => setSession(session)
|
|
11
|
+
);
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, [sessionUser]);
|
|
13
|
+
return () => sub.unsubscribe();
|
|
14
|
+
}, [setSession]);
|
|
19
15
|
|
|
20
|
-
return
|
|
16
|
+
return session;
|
|
21
17
|
}
|
|
18
|
+
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
// maintain alias for backwards compatibility
|
|
21
|
+
export const useSessionUser = useSession;
|
package/webpack.config.js
CHANGED
package/.babelrc
DELETED
package/babel.config.js
DELETED