|
|
@ -3,32 +3,40 @@ import { ReqPath } from '../constants/env'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function requestGet(url: string, data?: any): Promise<ResultType> { |
|
|
|
export function requestGet(url: string, data?: any): Promise<ResultType> { |
|
|
|
|
|
|
|
const requestURL = url ? ReqPath : `${ReqPath}/${url}`; |
|
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
Dec.reqGet(`${ReqPath}/${url}`, '', re => { |
|
|
|
Dec.reqGet(requestURL, '', re => { |
|
|
|
resolve(re); |
|
|
|
resolve(re); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function requestPost(url: string, data = {}): Promise<ResultType> { |
|
|
|
export function requestPost(url: string, data = {}): Promise<ResultType> { |
|
|
|
|
|
|
|
const requestURL = url ? ReqPath : `${ReqPath}/${url}`; |
|
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
Dec.reqPost(`${ReqPath}/${url}`, data, re => { |
|
|
|
Dec.reqPost(requestURL, data, re => { |
|
|
|
resolve(re); |
|
|
|
resolve(re); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function requestDelete(url: string, data = {}) { |
|
|
|
export function requestDelete(url: string, data = {}) { |
|
|
|
|
|
|
|
const requestURL = url ? ReqPath : `${ReqPath}/${url}`; |
|
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
Dec.reqDelete(`${ReqPath}/${url}`, data, re => { |
|
|
|
Dec.reqDelete(requestURL, data, re => { |
|
|
|
resolve(re); |
|
|
|
resolve(re); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function requestPut(url: string, data = {}) { |
|
|
|
export function requestPut(url: string, data = {}) { |
|
|
|
|
|
|
|
const requestURL = url ? ReqPath : `${ReqPath}/${url}`; |
|
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
Dec.reqPut(`${ReqPath}/${url}`, data, re => { |
|
|
|
Dec.reqPut(requestURL, data, re => { |
|
|
|
resolve(re); |
|
|
|
resolve(re); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|