Use the AbortController provided by the fetch polyfill

This commit is contained in:
Michael Lange 2020-05-20 14:58:50 -07:00
parent 899d8266f4
commit 20f209c4fb
1 changed files with 2 additions and 8 deletions

View File

@ -4,12 +4,7 @@ import { computed } from '@ember/object';
import RSVP from 'rsvp';
import { logger } from 'nomad-ui/utils/classes/log';
import timeout from 'nomad-ui/utils/timeout';
class MockAbortController {
abort() {
/* noop */
}
}
import { AbortController } from 'fetch';
export default Component.extend({
token: service(),
@ -52,8 +47,7 @@ export default Component.extend({
// If the log request can't settle in one second, the client
// must be unavailable and the server should be used instead
// AbortControllers don't exist in IE11, so provide a mock if it doesn't exist
const aborter = window.AbortController ? new AbortController() : new MockAbortController();
const aborter = new AbortController();
const timing = this.useServer ? this.serverTimeout : this.clientTimeout;
// Capture the state of useServer at logger create time to avoid a race