@asaleh37/ui-base 1.1.5 → 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 -18
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
|
};
|
|
@@ -69,32 +69,34 @@ const Login: React.FC = () => {
|
|
|
69
69
|
);
|
|
70
70
|
const loginTheme = createTheme(DarkThemeOptions);
|
|
71
71
|
const checkUserSession = async () => {
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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());
|
|
78
90
|
}
|
|
79
|
-
)
|
|
80
|
-
if (response != null && response.data != null) {
|
|
81
|
-
const UserSession = {
|
|
82
|
-
isAuthenticated: true,
|
|
83
|
-
authorities: response.data.authorities,
|
|
84
|
-
userProfile: response.data,
|
|
85
|
-
};
|
|
86
|
-
dispatch(UserSessionActions.setAuthenticated(UserSession));
|
|
87
|
-
} else {
|
|
91
|
+
} catch (error) {
|
|
88
92
|
dispatch(UserSessionActions.setUnAuthenticated());
|
|
89
93
|
}
|
|
90
|
-
} catch (error) {
|
|
91
|
-
dispatch(UserSessionActions.setUnAuthenticated());
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
useEffect(() => {
|
|
96
98
|
checkUserSession();
|
|
97
|
-
}, []);
|
|
99
|
+
}, [appInfo]);
|
|
98
100
|
return (
|
|
99
101
|
<ThemeProvider theme={loginTheme}>
|
|
100
102
|
<Paper
|