Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Jan 17, 2020
1 parent 6636f1d commit a4b43c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('response', () => {
http.intercept(interceptor);
fetchMock.mock('*', 200);

await http.fetch('/foo-api', { asSystemApi: true });
await http.fetch('/foo-api', { asSystemRequest: true });

expect(sessionTimeoutMock.extend).not.toHaveBeenCalled();
});
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('responseError', () => {
http.intercept(interceptor);
fetchMock.mock('*', 401);

await expect(http.fetch('/foo-api', { asSystemApi: true })).rejects.toMatchInlineSnapshot(
await expect(http.fetch('/foo-api', { asSystemRequest: true })).rejects.toMatchInlineSnapshot(
`[Error: Unauthorized]`
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { HttpInterceptor, HttpErrorResponse, HttpResponse, IAnonymousPaths } from 'src/core/public';
import {
HttpInterceptor,
HttpInterceptorResponseError,
HttpResponse,
IAnonymousPaths,
} from 'src/core/public';

import { ISessionTimeout } from './session_timeout';

Expand All @@ -16,19 +21,19 @@ export class SessionTimeoutHttpInterceptor implements HttpInterceptor {
return;
}

if (httpResponse.fetchOptions.asSystemApi) {
if (httpResponse.fetchOptions.asSystemRequest) {
return;
}

this.sessionTimeout.extend(httpResponse.request.url);
}

responseError(httpErrorResponse: HttpErrorResponse) {
responseError(httpErrorResponse: HttpInterceptorResponseError) {
if (this.anonymousPaths.isAnonymous(window.location.pathname)) {
return;
}

if (httpErrorResponse.fetchOptions.asSystemApi) {
if (httpErrorResponse.fetchOptions.asSystemRequest) {
return;
}

Expand Down

0 comments on commit a4b43c3

Please sign in to comment.