mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Merge pull request #1280 from atmire/fix-first-request-issue
Fix issue where the app wouldn't load for the first request in prod mode
This commit is contained in:
@@ -112,11 +112,15 @@ export class DspaceRestService {
|
|||||||
statusText: res.statusText
|
statusText: res.statusText
|
||||||
})),
|
})),
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
|
if (hasValue(err.status)) {
|
||||||
return observableThrowError({
|
return observableThrowError({
|
||||||
statusCode: err.status,
|
statusCode: err.status,
|
||||||
statusText: err.statusText,
|
statusText: err.statusText,
|
||||||
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
|
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return observableThrowError(err);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import { Router } from '@angular/router';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { CookieService } from '../services/cookie.service';
|
import { CookieService } from '../services/cookie.service';
|
||||||
|
import { hasValue } from '../../shared/empty.util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log Interceptor intercepting Http Requests & Responses to
|
* Log Interceptor intercepting Http Requests & Responses to
|
||||||
@@ -23,7 +24,9 @@ export class LogInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
// Add headers from the intercepted request
|
// Add headers from the intercepted request
|
||||||
let headers = request.headers;
|
let headers = request.headers;
|
||||||
|
if (hasValue(correlationId)) {
|
||||||
headers = headers.append('X-CORRELATION-ID', correlationId);
|
headers = headers.append('X-CORRELATION-ID', correlationId);
|
||||||
|
}
|
||||||
headers = headers.append('X-REFERRER', this.router.url);
|
headers = headers.append('X-REFERRER', this.router.url);
|
||||||
|
|
||||||
// Add new headers to the intercepted request
|
// Add new headers to the intercepted request
|
||||||
|
Reference in New Issue
Block a user