Use destructured signal (#10115)

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent 64adcae08d
commit c42087d044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/scripts/lib/fetch-with-timeout.js

@ -1,10 +1,10 @@
const fetchWithTimeout = ({ timeout = 120000 } = {}) => { const fetchWithTimeout = ({ timeout = 120000 } = {}) => {
return async function _fetch(url, opts) { return async function _fetch(url, opts) {
const abortController = new window.AbortController() const abortController = new window.AbortController()
const abortSignal = abortController.signal const { signal } = abortController
const f = window.fetch(url, { const f = window.fetch(url, {
...opts, ...opts,
signal: abortSignal, signal,
}) })
const timer = setTimeout(() => abortController.abort(), timeout) const timer = setTimeout(() => abortController.abort(), timeout)

Loading…
Cancel
Save