28 lines
506 B
JavaScript
28 lines
506 B
JavaScript
|
// let Token = localStorage.getItem("token")
|
||
|
let Token = uni.getStorageSync("token")
|
||
|
let request = (METHOD, URL, DATA) => {
|
||
|
return new Promise((reslove, reject) => {
|
||
|
uni.request({
|
||
|
url: 'https://ceshi-im.lihaink.cn/' + URL,
|
||
|
method: METHOD,
|
||
|
data: {
|
||
|
...DATA
|
||
|
},
|
||
|
header: {
|
||
|
'content-type': 'application/json',
|
||
|
"Authorization": Token || ""
|
||
|
|
||
|
},
|
||
|
success: function(res) {
|
||
|
reslove(res)
|
||
|
},
|
||
|
fail: function(err) {
|
||
|
reject(err)
|
||
|
},
|
||
|
|
||
|
});
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
export default request;
|