@asaleh37/ui-base 1.1.6 → 1.1.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/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/App.tsx +1 -2
- package/src/components/common/Login.tsx +20 -20
package/package.json
CHANGED
package/src/components/App.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { AppInfo, AppInfoActions } from "../redux/features/common/AppInfoSlice";
|
|
|
10
10
|
|
|
11
11
|
const App: React.FC<AppInfo> = (props: AppInfo) => {
|
|
12
12
|
const dispatch = useDispatch();
|
|
13
|
-
console.log("App Info", props);
|
|
14
13
|
const AppLayoutState = useSelector((state: RootState) => state.AppLayout);
|
|
15
14
|
let themeOptions = { ...LightThemeOptions };
|
|
16
15
|
if (AppLayoutState.themeMode === "dark") {
|
|
@@ -26,7 +25,7 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
|
|
|
26
25
|
}, []);
|
|
27
26
|
return (
|
|
28
27
|
<ThemeProvider theme={theme}>
|
|
29
|
-
|
|
28
|
+
<Layout />
|
|
30
29
|
</ThemeProvider>
|
|
31
30
|
);
|
|
32
31
|
};
|
|
@@ -36,8 +36,6 @@ const Login: React.FC = () => {
|
|
|
36
36
|
}
|
|
37
37
|
setIsLoginInProcess(true);
|
|
38
38
|
let response: any = null;
|
|
39
|
-
console.log("login appinfo", appInfo);
|
|
40
|
-
debugger;
|
|
41
39
|
try {
|
|
42
40
|
response = await axios.post(
|
|
43
41
|
`${appInfo.apiBaseUrl}/api/auth/login`,
|
|
@@ -71,32 +69,34 @@ const Login: React.FC = () => {
|
|
|
71
69
|
);
|
|
72
70
|
const loginTheme = createTheme(DarkThemeOptions);
|
|
73
71
|
const checkUserSession = async () => {
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
if (appInfo?.apiBaseUrl) {
|
|
73
|
+
if (userSession.isAuthenticated == null) {
|
|
74
|
+
try {
|
|
75
|
+
let response = await axios.get(
|
|
76
|
+
`${appInfo.apiBaseUrl}/api/auth/userInfo`,
|
|
77
|
+
{
|
|
78
|
+
withCredentials: true,
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
if (response != null && response.data != null) {
|
|
82
|
+
const UserSession = {
|
|
83
|
+
isAuthenticated: true,
|
|
84
|
+
authorities: response.data.authorities,
|
|
85
|
+
userProfile: response.data,
|
|
86
|
+
};
|
|
87
|
+
dispatch(UserSessionActions.setAuthenticated(UserSession));
|
|
88
|
+
} else {
|
|
89
|
+
dispatch(UserSessionActions.setUnAuthenticated());
|
|
80
90
|
}
|
|
81
|
-
)
|
|
82
|
-
if (response != null && response.data != null) {
|
|
83
|
-
const UserSession = {
|
|
84
|
-
isAuthenticated: true,
|
|
85
|
-
authorities: response.data.authorities,
|
|
86
|
-
userProfile: response.data,
|
|
87
|
-
};
|
|
88
|
-
dispatch(UserSessionActions.setAuthenticated(UserSession));
|
|
89
|
-
} else {
|
|
91
|
+
} catch (error) {
|
|
90
92
|
dispatch(UserSessionActions.setUnAuthenticated());
|
|
91
93
|
}
|
|
92
|
-
} catch (error) {
|
|
93
|
-
dispatch(UserSessionActions.setUnAuthenticated());
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
useEffect(() => {
|
|
98
98
|
checkUserSession();
|
|
99
|
-
}, []);
|
|
99
|
+
}, [appInfo]);
|
|
100
100
|
return (
|
|
101
101
|
<ThemeProvider theme={loginTheme}>
|
|
102
102
|
<Paper
|