monkey-front-core 22.2.3 → 22.2.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.
|
@@ -2571,7 +2571,7 @@ class MonkeyEcxRequestStateService {
|
|
|
2571
2571
|
clearData(id) {
|
|
2572
2572
|
requestsMap.delete(id);
|
|
2573
2573
|
}
|
|
2574
|
-
getHeaders(url) {
|
|
2574
|
+
getHeaders(url, skipAuthorization = false) {
|
|
2575
2575
|
const isTokenMandatory = () => {
|
|
2576
2576
|
return !(this._bootstrapService
|
|
2577
2577
|
.getNotMandatoryUrls()
|
|
@@ -2583,7 +2583,7 @@ class MonkeyEcxRequestStateService {
|
|
|
2583
2583
|
if (!isTokenMandatory())
|
|
2584
2584
|
return {};
|
|
2585
2585
|
const token = this._tokenStorageService.getToken();
|
|
2586
|
-
let program = token
|
|
2586
|
+
let program = token?.program;
|
|
2587
2587
|
try {
|
|
2588
2588
|
program = this._bootstrapService.handleProgram?.(program) || program;
|
|
2589
2589
|
}
|
|
@@ -2591,11 +2591,13 @@ class MonkeyEcxRequestStateService {
|
|
|
2591
2591
|
//not to do
|
|
2592
2592
|
}
|
|
2593
2593
|
const headers = {
|
|
2594
|
-
Authorization: '',
|
|
2595
2594
|
Program: ''
|
|
2596
2595
|
};
|
|
2597
|
-
if (
|
|
2598
|
-
headers.Authorization =
|
|
2596
|
+
if (!skipAuthorization) {
|
|
2597
|
+
headers.Authorization = '';
|
|
2598
|
+
if (MonkeyEcxUtils.persistNullEmptyUndefined(token?.accessToken)) {
|
|
2599
|
+
headers.Authorization = `Bearer ${token?.accessToken}`;
|
|
2600
|
+
}
|
|
2599
2601
|
}
|
|
2600
2602
|
if (MonkeyEcxUtils.persistNullEmptyUndefined(program)) {
|
|
2601
2603
|
headers.Program = program;
|
|
@@ -5128,12 +5130,13 @@ const monkeyEcxHttpConfigInterceptor = (req, next) => {
|
|
|
5128
5130
|
return next(req);
|
|
5129
5131
|
}
|
|
5130
5132
|
const state = requestId ? requestStateService.getData(requestId) : null;
|
|
5131
|
-
const
|
|
5133
|
+
const skipAuthorization = !!state?.skipAuthorization;
|
|
5134
|
+
const headers = requestStateService.getHeaders(req.url, skipAuthorization);
|
|
5132
5135
|
const updatedReq = req.clone({ setHeaders: headers });
|
|
5133
5136
|
return next(updatedReq).pipe(map$1((event) => {
|
|
5134
5137
|
return event;
|
|
5135
5138
|
}), catchError$1((error) => {
|
|
5136
|
-
if (refreshShouldHappen(error)) {
|
|
5139
|
+
if (!skipAuthorization && refreshShouldHappen(error)) {
|
|
5137
5140
|
requestErrorService.handleError(error, state);
|
|
5138
5141
|
return requestStateService.handleRefreshTokenError(req, next);
|
|
5139
5142
|
}
|