@applica-software-guru/react-admin 1.4.0-beta.5 → 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.5",
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) {
@@ -219,7 +219,7 @@ function LayoutProvider(props: ILayoutProviderProps) {
219
219
  }, [theme.palette.mode]);
220
220
 
221
221
  useEffect(() => {
222
- authProvider.isImpersonating().then((isImpersonating: boolean) => {
222
+ authProvider?.isImpersonating().then((isImpersonating: boolean) => {
223
223
  setNeedToChangePassword(!isImpersonating && identity?.data?.needToChangePassword === true);
224
224
  });
225
225
  }, [identity?.data?.needToChangePassword, authProvider]);