@asaleh37/ui-base 25.8.1-5.1 → 25.8.1-5.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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/BaseApp.tsx +27 -20
- package/src/components/common/Login.tsx +3 -7
package/package.json
CHANGED
|
@@ -18,33 +18,40 @@ import i18n from "../locales/i18n";
|
|
|
18
18
|
import { initReactI18next } from "react-i18next";
|
|
19
19
|
import { ENGLISH_TRANS } from "../locales/english";
|
|
20
20
|
import { ARABIC_TRANS } from "../locales/arabic";
|
|
21
|
+
import { useEffect } from "react";
|
|
21
22
|
|
|
22
23
|
library.add(fab);
|
|
23
24
|
library.add(far);
|
|
24
25
|
library.add(fas);
|
|
25
26
|
|
|
26
27
|
export const BaseApp: React.FC<AppInfo> = (props) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
let store = configureStore({ reducer: {} });
|
|
29
|
+
const initializeApp = () => {
|
|
30
|
+
const systemReducers = {
|
|
31
|
+
AppLayout: AppLayoutReducer,
|
|
32
|
+
UserSession: UserSessionReducer,
|
|
33
|
+
loadingMask: LoadingMaskReducer,
|
|
34
|
+
commonStores: CommonStoreReducer,
|
|
35
|
+
SideBar: SideBarReducer,
|
|
36
|
+
AppInfo: AppInfoReducer,
|
|
37
|
+
...props?.businessReduxReducers,
|
|
38
|
+
};
|
|
39
|
+
store = configureStore({
|
|
40
|
+
reducer: systemReducers,
|
|
41
|
+
});
|
|
42
|
+
const resources = {
|
|
43
|
+
en: { translation: { ...ENGLISH_TRANS, ...props?.businessLocals?.en } },
|
|
44
|
+
ar: { translation: { ...ARABIC_TRANS, ...props?.businessLocals?.ar } },
|
|
45
|
+
};
|
|
46
|
+
i18n.use(initReactI18next).init({
|
|
47
|
+
resources: resources, // Where we're gonna put translations' files
|
|
48
|
+
lng: localStorage.getItem("language") || "en", // Set the initial language of the App
|
|
49
|
+
fallbackLng: "en",
|
|
50
|
+
});
|
|
35
51
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
const resources = {
|
|
40
|
-
en: { translation: { ...ENGLISH_TRANS, ...props?.businessLocals?.en } },
|
|
41
|
-
ar: { translation: { ...ARABIC_TRANS, ...props?.businessLocals?.ar } },
|
|
42
|
-
};
|
|
43
|
-
i18n.use(initReactI18next).init({
|
|
44
|
-
resources: resources, // Where we're gonna put translations' files
|
|
45
|
-
lng: localStorage.getItem("language") || "en", // Set the initial language of the App
|
|
46
|
-
fallbackLng: "en",
|
|
47
|
-
});
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
initializeApp();
|
|
54
|
+
}, [props]);
|
|
48
55
|
return (
|
|
49
56
|
<Provider store={store}>
|
|
50
57
|
<App {...props} />
|
|
@@ -124,15 +124,11 @@ const Login: React.FC = () => {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
useEffect(() => {
|
|
127
|
+
console.log("checking usersession on reload", userSession);
|
|
128
|
+
console.log("checking usersession app info", appInfo);
|
|
127
129
|
checkUserSession();
|
|
128
|
-
}, [appInfo]);
|
|
130
|
+
}, [appInfo, userSession.isAuthenticated]);
|
|
129
131
|
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
if (userSession.isAuthenticated === null) {
|
|
132
|
-
console.log("checking usersession on reload", userSession);
|
|
133
|
-
checkUserSession();
|
|
134
|
-
}
|
|
135
|
-
}, [userSession.isAuthenticated]);
|
|
136
132
|
return (
|
|
137
133
|
<ThemeProvider theme={loginTheme}>
|
|
138
134
|
<Paper
|