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

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.6",
3
+ "version": "1.4.0-beta.7",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,16 +8,18 @@ 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);
15
15
 
16
16
  useEffect(() => {
17
17
  if (!authProvider.isImpersonating) {
18
+ // eslint-disable-next-line no-console
19
+ console.warn('The authProvider does not support the isImpersonating feature', authProvider);
18
20
  return;
19
21
  }
20
- authProvider?.isImpersonating().then((isImpersonating: boolean) => setIsImpersonating(isImpersonating));
22
+ authProvider.isImpersonating().then((isImpersonating: boolean) => setIsImpersonating(isImpersonating));
21
23
  }, [authProvider, setIsImpersonating]);
22
24
 
23
25
  if (!isImpersonating) {
@@ -219,6 +219,12 @@ function LayoutProvider(props: ILayoutProviderProps) {
219
219
  }, [theme.palette.mode]);
220
220
 
221
221
  useEffect(() => {
222
+ // Check if authProvider contains a method called isImpersonating
223
+ if (!authProvider.isImpersonating) {
224
+ // eslint-disable-next-line no-console
225
+ console.warn('authProvider does not contain a method called isImpersonating', authProvider);
226
+ return;
227
+ }
222
228
  authProvider?.isImpersonating().then((isImpersonating: boolean) => {
223
229
  setNeedToChangePassword(!isImpersonating && identity?.data?.needToChangePassword === true);
224
230
  });