@applica-software-guru/react-admin 1.4.0-beta.4 → 1.4.0-beta.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.4.0-beta.4",
3
+ "version": "1.4.0-beta.6",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@ const StopImpersonateButton = () => {
8
8
  const translate = useTranslate();
9
9
  const authProvider = useAuthProvider();
10
10
  const stopImpersonating = useCallback(
11
- () => authProvider.stopImpersonate().then(() => (document.location.href = '/')),
11
+ () => authProvider?.stopImpersonate().then(() => (document.location.href = '/')),
12
12
  [authProvider?.stopImpersonating]
13
13
  );
14
14
  const [isImpersonating, setIsImpersonating] = useState(false);
@@ -17,7 +17,7 @@ const StopImpersonateButton = () => {
17
17
  if (!authProvider.isImpersonating) {
18
18
  return;
19
19
  }
20
- authProvider.isImpersonating().then((isImpersonating: boolean) => setIsImpersonating(isImpersonating));
20
+ authProvider?.isImpersonating().then((isImpersonating: boolean) => setIsImpersonating(isImpersonating));
21
21
  }, [authProvider, setIsImpersonating]);
22
22
 
23
23
  if (!isImpersonating) {
@@ -132,6 +132,8 @@ const DefaultState: ILayoutState = {
132
132
 
133
133
  function LayoutProvider(props: ILayoutProviderProps) {
134
134
  const authProvider = useAuthProvider<IApplicaAuthProvider>();
135
+ // eslint-disable-next-line no-console
136
+ console.log('authProvider: ', authProvider);
135
137
  const identity = useGetIdentity() as UseGetIdentityResult,
136
138
  theme = useTheme(),
137
139
  downMd = useMediaQuery(theme.breakpoints.down('md')),
@@ -217,7 +219,7 @@ function LayoutProvider(props: ILayoutProviderProps) {
217
219
  }, [theme.palette.mode]);
218
220
 
219
221
  useEffect(() => {
220
- authProvider.isImpersonating().then((isImpersonating: boolean) => {
222
+ authProvider?.isImpersonating().then((isImpersonating: boolean) => {
221
223
  setNeedToChangePassword(!isImpersonating && identity?.data?.needToChangePassword === true);
222
224
  });
223
225
  }, [identity?.data?.needToChangePassword, authProvider]);