修改网络请求

master
夜笙歌 2 years ago
parent 1cc5b8c6b8
commit 4293840522

@ -4,17 +4,21 @@ async function autoUpdate(url, interval, callback = () => {}, method = 'post') {
type: method,
url: url,
dataType: 'json',
timeout:9000,
success: function (data) {
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
callback(data)
resolve(data)
},
error: function (reason) {
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
console.error(reason)
reject(reason)
}
})
})
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
}
const INTERVAL = 10000

Loading…
Cancel
Save