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.
- package/dist/MuffinAdmin.d.ts +2 -1
- package/dist/MuffinAdmin.js +10 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinAdmin.tsx +18 -6
- package/src/index.tsx +1 -1
package/package.json
CHANGED
package/src/MuffinAdmin.tsx
CHANGED
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
LayoutProps,
|
|
14
14
|
localStorageStore,
|
|
15
15
|
Login,
|
|
16
|
+
LoginProps,
|
|
16
17
|
} from "react-admin"
|
|
17
18
|
|
|
19
|
+
import { useEffect } from "react"
|
|
18
20
|
import { ConfirmationProvider } from "./common"
|
|
19
21
|
import { useMuffinAdminOpts } from "./hooks"
|
|
20
22
|
import { buildProvider, muffinTranslations } from "./i18n"
|
|
@@ -28,11 +30,11 @@ export function MuffinAdmin(props: AdminProps) {
|
|
|
28
30
|
const muffinI18nProvider = buildProvider(
|
|
29
31
|
backendLocales
|
|
30
32
|
? Object.fromEntries(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
Object.entries(muffinTranslations).map(([locale, messages]) => [
|
|
34
|
+
locale,
|
|
35
|
+
deepMerge({}, messages, backendLocales[locale], buildAdmin(["locale", locale]) || {}),
|
|
36
|
+
])
|
|
37
|
+
)
|
|
36
38
|
: muffinTranslations
|
|
37
39
|
)
|
|
38
40
|
|
|
@@ -132,5 +134,15 @@ export function MuffinAppBar(props: AppBarProps) {
|
|
|
132
134
|
|
|
133
135
|
setupAdmin(["appbar"], MuffinAppBar)
|
|
134
136
|
|
|
137
|
+
export function MuffinLogin(props: LoginProps) {
|
|
138
|
+
const {
|
|
139
|
+
auth: { loginURL },
|
|
140
|
+
} = useMuffinAdminOpts()
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (loginURL) window.location.replace(loginURL)
|
|
143
|
+
}, [loginURL])
|
|
144
|
+
return <Login {...props} />
|
|
145
|
+
}
|
|
146
|
+
|
|
135
147
|
// Initialize login page
|
|
136
|
-
setupAdmin(["loginpage"],
|
|
148
|
+
setupAdmin(["loginpage"], MuffinLogin)
|
package/src/index.tsx
CHANGED