@ordentco/addons-auth-provider 0.9.102 → 0.9.103
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.
|
@@ -87,23 +87,17 @@ exports.customAxios.interceptors.request.use(function (config) { return __awaite
|
|
|
87
87
|
exports.customAxios.interceptors.response.use(function (response) {
|
|
88
88
|
return response;
|
|
89
89
|
}, function (error) {
|
|
90
|
-
var _a, _b, _c
|
|
90
|
+
var _a, _b, _c;
|
|
91
91
|
// const originalRequest = error.config;
|
|
92
92
|
var pathname = window.location.pathname;
|
|
93
93
|
var isMain = pathname === '/main-page';
|
|
94
94
|
var isMainWithParam = pathname === '/main-page?logout=true';
|
|
95
|
-
|
|
96
|
-
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 && (
|
|
97
|
-
localStorage.removeItem("access-token");
|
|
98
|
-
localStorage.removeItem("refresh-token");
|
|
99
|
-
window.location.href = "/main-page?logout=true";
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
95
|
+
// const isDashboard = pathname === '/homepage';
|
|
96
|
+
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 && !(isMain || isMainWithParam)) {
|
|
103
97
|
document.dispatchEvent(new Event("showDialog"));
|
|
104
98
|
return Promise.reject(__assign({}, error));
|
|
105
99
|
}
|
|
106
|
-
if (((
|
|
100
|
+
if (((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) === "Another Login Detected" || (error === null || error === void 0 ? void 0 : error.message) === "Another Login Detected") {
|
|
107
101
|
localStorage.removeItem("access-token");
|
|
108
102
|
localStorage.removeItem("refresh-token");
|
|
109
103
|
window.location.href = "/main-page?logout=true";
|
|
@@ -1 +1 @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AY;IACZ,EAAE;IACF,iDAAiD;IACjD,wDAAwD;IACxD,mDAAmD;IACnD,6CAA6C;IAC7C,EAAE;IACF,uDAAuD;IACvD,+DAA+D;IAC/D,EAAE;IACF,oFAAoF;IACpF,wEAAwE;IACxE,EAAE;IACF,qFAAqF;IACrF,uFAAuF;IACvF,4DAA4D;IAC5D,EAAE;IACF,sHAAsH;IACtH,8EAA8E;IAC9E,6FAA6F;IAC7F,uEAAuE;IACvE,+CAA+C;IAC/C,gDAAgD;IAChD,EAAE;IACF,sHAAsH;IACtH,8EAA8E;IAC9E,cAAc;IACd,YAAY;IACZ,EAAE;IACF,qCAAqC;IACrC,EAAE;IACF,iDAAiD;IACjD,WAAW;IACX,0BAA0B;IAC1B,mGAAmG;IACnG,qDAAqD;IACrD,sDAAsD;IACtD,EAAE;IACF,6DAA6D;IAC7D,EAAE;IACF,oBAAoB;IACpB,YAAY;IACZ,EAAE;IACF,mCAAmC;IACnC,uBAAuB;IACvB,WAAW;IACX,yBAAyB;IACzB,gCAAgC;IAChC,YAAY;IACZ,QAAQ;IACR,IAAI;IACJ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,MAAM,uBAChB,KAAK,KACR,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,IAC7E,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC,CACF,CAAC;AAEF,gGAAgG;AAChG,EAAE;AACF,EAAE;AACF,yHAAyH;AACzH,EAAE;AACF,iDAAiD;AACjD,4CAA4C;AAC5C,EAAE;AACF,KAAK;AAEL,kBAAe,mBAAW,CAAC"}
|
package/package.json
CHANGED
package/services/custom-axios.ts
CHANGED
|
@@ -52,16 +52,9 @@ customAxios.interceptors.response.use(
|
|
|
52
52
|
const pathname = window.location.pathname;
|
|
53
53
|
const isMain = pathname === '/main-page';
|
|
54
54
|
const isMainWithParam = pathname === '/main-page?logout=true';
|
|
55
|
-
const isDashboard = pathname === '/homepage';
|
|
55
|
+
// const isDashboard = pathname === '/homepage';
|
|
56
56
|
|
|
57
|
-
if(error?.response?.status === 401 && (
|
|
58
|
-
localStorage.removeItem("access-token");
|
|
59
|
-
localStorage.removeItem("refresh-token");
|
|
60
|
-
window.location.href = "/main-page?logout=true";
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (error?.response?.status === 401) {
|
|
57
|
+
if (error?.response?.status === 401 && !(isMain || isMainWithParam)) {
|
|
65
58
|
document.dispatchEvent(new Event("showDialog"));
|
|
66
59
|
return Promise.reject({
|
|
67
60
|
...error,
|