muffin-admin 9.4.1 → 9.4.3

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.
@@ -1,4 +1,5 @@
1
- import { AdminProps, AppBarProps, LayoutProps } from "react-admin";
1
+ import { AdminProps, AppBarProps, LayoutProps, LoginProps } from "react-admin";
2
2
  export declare function MuffinAdmin(props: AdminProps): import("react/jsx-runtime").JSX.Element;
3
3
  export declare function MuffinAdminLayout(props: LayoutProps): import("react/jsx-runtime").JSX.Element;
4
4
  export declare function MuffinAppBar(props: AppBarProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function MuffinLogin(props: LoginProps): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,7 @@ import SvgIcon from "@mui/material/SvgIcon";
4
4
  import Tooltip from "@mui/material/Tooltip";
5
5
  import Typography from "@mui/material/Typography";
6
6
  import { AdminContext, AdminUI, AppBar, Layout, localStorageStore, Login, } from "react-admin";
7
+ import { useEffect } from "react";
7
8
  import { ConfirmationProvider } from "./common";
8
9
  import { useMuffinAdminOpts } from "./hooks";
9
10
  import { buildProvider, muffinTranslations } from "./i18n";
@@ -36,5 +37,13 @@ export function MuffinAppBar(props) {
36
37
  } }), appBarLinks.map((info) => (_jsx(Tooltip, { title: info.title, children: _jsx(IconButton, { color: "inherit", href: info.url, children: _jsx(SvgIcon, { component: findIcon(info.icon) }) }) }, info.url)))] })));
37
38
  }
38
39
  setupAdmin(["appbar"], MuffinAppBar);
40
+ export function MuffinLogin(props) {
41
+ const { auth: { loginURL }, } = useMuffinAdminOpts();
42
+ useEffect(() => {
43
+ if (loginURL)
44
+ window.location.replace(loginURL);
45
+ }, [loginURL]);
46
+ return _jsx(Login, Object.assign({}, props));
47
+ }
39
48
  // Initialize login page
40
- setupAdmin(["loginpage"], Login);
49
+ setupAdmin(["loginpage"], MuffinLogin);
package/dist/index.d.ts CHANGED
@@ -19,4 +19,4 @@ export * from "./fields";
19
19
  export * from "./hooks";
20
20
  export * from "./types";
21
21
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
22
- export declare const VERSION = "9.4.1";
22
+ export declare const VERSION = "9.4.3";
package/dist/index.js CHANGED
@@ -42,4 +42,4 @@ export function initAdmin() {
42
42
  root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
43
43
  });
44
44
  }
45
- export const VERSION = "9.4.1";
45
+ export const VERSION = "9.4.3";