nurseitaly-components 0.0.11 → 0.0.12
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,12 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import CommonContext from './CommonContext';
|
|
3
|
+
import { registerCommonDispatch } from './commonDispatch';
|
|
4
|
+
/** Registers CommonContext.dispatch for non-React callers (e.g. axios interceptors). */
|
|
5
|
+
export default function CommonDispatchBridge() {
|
|
6
|
+
const { dispatch } = useContext(CommonContext);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
registerCommonDispatch(dispatch);
|
|
9
|
+
return () => registerCommonDispatch(() => undefined);
|
|
10
|
+
}, [dispatch]);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SessionAction } from './sessionTypes';
|
|
2
|
+
type CommonDispatch = (action: SessionAction) => void;
|
|
3
|
+
export declare function registerCommonDispatch(dispatch: CommonDispatch): void;
|
|
4
|
+
export declare function getCommonDispatch(): CommonDispatch | null;
|
|
5
|
+
export {};
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as CommonContext, CommonProvider } from './CommonContext';
|
|
2
|
+
export { default as CommonDispatchBridge } from './CommonDispatchBridge';
|
|
3
|
+
export { getCommonDispatch, registerCommonDispatch, } from './commonDispatch';
|
|
2
4
|
export { default as CookieStorage } from './CookieStorage';
|
|
3
5
|
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
4
6
|
export { default as ProfileService } from './services/ProfileService';
|
package/dist/configs/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as CommonContext, CommonProvider } from './CommonContext';
|
|
2
|
+
export { default as CommonDispatchBridge } from './CommonDispatchBridge';
|
|
3
|
+
export { getCommonDispatch, registerCommonDispatch, } from './commonDispatch';
|
|
2
4
|
export { default as CookieStorage } from './CookieStorage';
|
|
3
5
|
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
4
6
|
export { default as ProfileService } from './services/ProfileService';
|