Commit 1bf08237 authored by JingChao's avatar JingChao

Update hlsHttp.js

parent 44c753e9
......@@ -7,6 +7,9 @@ const CancelToken = axios.CancelToken
// 请求拦截器
axios.interceptors.request.use(config => {
// 发起请求时,取消掉当前正在进行的相同请求
config.cancelToken = new CancelToken(c => {
cancel = c
})
if (promiseArr[config.url]) {
promiseArr[config.url]('操作取消')
promiseArr[config.url] = cancel
......@@ -104,9 +107,6 @@ export function get (url) {
url,
headers: headers,
params: param,
cancelToken: new CancelToken(c => {
cancel = c
}),
}).then(res => {
resolve(res)
}).catch(err => {
......@@ -141,9 +141,6 @@ export function post (url, param) {
headers: headers,
url,
data: param,
cancelToken: new CancelToken(c => {
cancel = c
}),
}).then(res => {
resolve(res)
}).catch(err => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment