OA/api/index.js

28 lines
506 B
JavaScript
Raw Permalink Normal View History

2023-11-05 00:08:34 +08:00
// 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;