package yourself
let responseSuccess = (response, success, failure, autoAlert) => {
}
let responseFailure = (response) => {
}
module.exports = {
get: (uri, success, failure, autoAlert=true) => {
wx.request({
url: host+uri,
method: "GET",
header: getHeader(),
success: (response) => {
responseSuccess(response, success, failure, autoAlert)
},
fail: responseFailure
})
},
post: (uri, data, success, failure, autoAlert=true) => {
wx.request({
url: host + uri,
method: "POST",
header: getHeader(),
data: Util.usNameWithObject(data, true),
success: (response) => {
responseSuccess(response, success, failure, autoAlert)
},
fail: responseFailure
})
},
put: (uri, data, success, failure, autoAlert=true) => {
wx.request({
url: host + uri,
method: "PUT",
header: getHeader(),
data: Util.usNameWithObject(data, true),
success: (response) => {
responseSuccess(response, success, failure, autoAlert)
},
fail: responseFailure
})
},
del: (uri, success, failure, autoAlert=true) => {
wx.request({
url: host + uri,
method: "DELETE",
header: getHeader(),
success: (response) => {
responseSuccess(response, success, failure, autoAlert)
},
fail: responseFailure
})
}
}