@ollaid/native-sso 1.0.3 → 1.0.4
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/components/NativeSSOPage.d.ts +5 -1
- package/dist/index.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4147,7 +4147,9 @@ function NativeSSOPage({
|
|
|
4147
4147
|
title = "Un compte, plusieurs accès",
|
|
4148
4148
|
description = "Connectez-vous avec votre compte Ollaid pour accéder à toutes les applications partenaires.",
|
|
4149
4149
|
logoUrl,
|
|
4150
|
-
hideFooter = false
|
|
4150
|
+
hideFooter = false,
|
|
4151
|
+
redirectAfterLogin,
|
|
4152
|
+
redirectAfterLogout
|
|
4151
4153
|
}) {
|
|
4152
4154
|
const [modal, setModal] = useState("none");
|
|
4153
4155
|
const [showOnboarding, setShowOnboarding] = useState(false);
|
|
@@ -4216,8 +4218,9 @@ function NativeSSOPage({
|
|
|
4216
4218
|
} else {
|
|
4217
4219
|
setSession({ token, user: userObj });
|
|
4218
4220
|
onLoginSuccess == null ? void 0 : onLoginSuccess(token, user);
|
|
4221
|
+
if (redirectAfterLogin) window.location.href = redirectAfterLogin;
|
|
4219
4222
|
}
|
|
4220
|
-
}, [onLoginSuccess]);
|
|
4223
|
+
}, [onLoginSuccess, redirectAfterLogin]);
|
|
4221
4224
|
const handleOnboardingComplete = useCallback((data) => {
|
|
4222
4225
|
if (!pendingSession) return;
|
|
4223
4226
|
const updatedUser = { ...pendingSession.user, ...data };
|
|
@@ -4227,14 +4230,16 @@ function NativeSSOPage({
|
|
|
4227
4230
|
setPendingSession(null);
|
|
4228
4231
|
onOnboardingComplete == null ? void 0 : onOnboardingComplete(data);
|
|
4229
4232
|
onLoginSuccess == null ? void 0 : onLoginSuccess(pendingSession.token, updatedUser);
|
|
4230
|
-
|
|
4233
|
+
if (redirectAfterLogin) window.location.href = redirectAfterLogin;
|
|
4234
|
+
}, [pendingSession, onLoginSuccess, onOnboardingComplete, redirectAfterLogin]);
|
|
4231
4235
|
const handleOnboardingSkip = useCallback(() => {
|
|
4232
4236
|
if (!pendingSession) return;
|
|
4233
4237
|
setShowOnboarding(false);
|
|
4234
4238
|
setSession(pendingSession);
|
|
4235
4239
|
setPendingSession(null);
|
|
4236
4240
|
onLoginSuccess == null ? void 0 : onLoginSuccess(pendingSession.token, pendingSession.user);
|
|
4237
|
-
|
|
4241
|
+
if (redirectAfterLogin) window.location.href = redirectAfterLogin;
|
|
4242
|
+
}, [pendingSession, onLoginSuccess, redirectAfterLogin]);
|
|
4238
4243
|
const handleLogout = useCallback(() => {
|
|
4239
4244
|
localStorage.removeItem(STORAGE.AUTH_TOKEN);
|
|
4240
4245
|
localStorage.removeItem(STORAGE.TOKEN);
|
|
@@ -4243,7 +4248,8 @@ function NativeSSOPage({
|
|
|
4243
4248
|
localStorage.removeItem(STORAGE.ALIAS_REFERENCE);
|
|
4244
4249
|
setSession(null);
|
|
4245
4250
|
onLogout == null ? void 0 : onLogout();
|
|
4246
|
-
|
|
4251
|
+
if (redirectAfterLogout) window.location.href = redirectAfterLogout;
|
|
4252
|
+
}, [onLogout, redirectAfterLogout]);
|
|
4247
4253
|
const containerStyle = {
|
|
4248
4254
|
minHeight: "100vh",
|
|
4249
4255
|
backgroundColor: COLORS.primary,
|