27 lines
511 B
JavaScript
27 lines
511 B
JavaScript
import {
|
|
URL,
|
|
appid
|
|
} from './url'
|
|
|
|
const request = (option) => {
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
|
url: URL + option.url,
|
|
method: option.method,
|
|
data: option.data,
|
|
header: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
...option.headers,
|
|
'appid': appid,
|
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
|
'Clientid': uni.getStorageSync('client_id')
|
|
},
|
|
success(res) {
|
|
resolve(res.data)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
export default request |