Skip to content

Commit

Permalink
Merge pull request #1280 from atmire/fix-first-request-issue
Browse files Browse the repository at this point in the history
Fix issue where the app wouldn't load for the first request in prod mode
  • Loading branch information
tdonohue committed Jul 26, 2021
2 parents e9a0399 + 8ee1286 commit 4292af4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/app/core/dspace-rest/dspace-rest.service.ts
Expand Up @@ -112,11 +112,15 @@ export class DspaceRestService {
statusText: res.statusText
})),
catchError((err) => {
return observableThrowError({
statusCode: err.status,
statusText: err.statusText,
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
});
if (hasValue(err.status)) {
return observableThrowError({
statusCode: err.status,
statusText: err.statusText,
message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message
});
} else {
return observableThrowError(err);
}
}));
}

Expand Down
5 changes: 4 additions & 1 deletion src/app/core/log/log.interceptor.ts
Expand Up @@ -5,6 +5,7 @@ import { Router } from '@angular/router';
import { Observable } from 'rxjs';

import { CookieService } from '../services/cookie.service';
import { hasValue } from '../../shared/empty.util';

/**
* Log Interceptor intercepting Http Requests & Responses to
Expand All @@ -23,7 +24,9 @@ export class LogInterceptor implements HttpInterceptor {

// Add headers from the intercepted request
let headers = request.headers;
headers = headers.append('X-CORRELATION-ID', correlationId);
if (hasValue(correlationId)) {
headers = headers.append('X-CORRELATION-ID', correlationId);
}
headers = headers.append('X-REFERRER', this.router.url);

// Add new headers to the intercepted request
Expand Down

0 comments on commit 4292af4

Please sign in to comment.