@legalplace/wizardx-core 4.13.3 → 4.14.0
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const redirectToLogin: (redirectUrl: string, redirectParams?: boolean) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const redirectToLogin = (redirectUrl, redirectParams = false) => {
|
|
2
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
3
|
+
const redirectURL = new URL(redirectUrl, window.location.origin);
|
|
4
|
+
currentParams.forEach((value, key) => {
|
|
5
|
+
redirectURL.searchParams.append(key, value);
|
|
6
|
+
});
|
|
7
|
+
if (redirectParams) {
|
|
8
|
+
redirectURL.searchParams.append("redirectUrl", encodeURIComponent(window.location.href));
|
|
9
|
+
}
|
|
10
|
+
window.onbeforeunload = null;
|
|
11
|
+
window.location.href = redirectURL.toString();
|
|
12
|
+
};
|
|
@@ -21,6 +21,7 @@ import { FETCH_MODEL, FETCH_MODEL_PREREQUISITES, } from "../constants/sagas/mode
|
|
|
21
21
|
import { fetchModelAction } from "../actions/sagas/model";
|
|
22
22
|
import { initInputsDecorator } from "./initInputs";
|
|
23
23
|
import { cancelOnResetState } from "../../helpers/sagaCancelOnResetState";
|
|
24
|
+
import { redirectToLogin } from "../../helpers/redirectToLogin";
|
|
24
25
|
const cookies = new Cookies();
|
|
25
26
|
function* setFetchModelToNonBlocking(firstCurrentAppState) {
|
|
26
27
|
yield put(initPaginationAction({
|
|
@@ -82,10 +83,7 @@ function* getWizardConfig(permalink, uniqidParam, prefix, queryParams) {
|
|
|
82
83
|
}
|
|
83
84
|
response = yield call([response, "json"]);
|
|
84
85
|
if (response.redirect) {
|
|
85
|
-
|
|
86
|
-
window.location.href = `${response.redirect}${response.redirectParams
|
|
87
|
-
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
88
|
-
: ""}`;
|
|
86
|
+
redirectToLogin(response.redirect, response.redirectParams);
|
|
89
87
|
}
|
|
90
88
|
yield put(setModelUuidAction(response.modelUuid));
|
|
91
89
|
return { modelUuid: response.modelUuid };
|
|
@@ -132,10 +130,7 @@ function* fetchInstanceInformation(appStates, permalink, uniqid, uniqidParam, pr
|
|
|
132
130
|
}
|
|
133
131
|
response = yield call([response, "json"]);
|
|
134
132
|
if (response.redirect) {
|
|
135
|
-
|
|
136
|
-
window.location.href = `${response.redirect}${response.redirectParams
|
|
137
|
-
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
138
|
-
: ""}`;
|
|
133
|
+
redirectToLogin(response.redirect, response.redirectParams);
|
|
139
134
|
}
|
|
140
135
|
if (response.errors || response.status === "error") {
|
|
141
136
|
throw new Error(`Unable to fetch ${permalink}${uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"*.test.ts",
|
|
97
97
|
"*.test.tsx"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "9c5402206e418e9aba10b90da7c95d088d85961f"
|
|
100
100
|
}
|