You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
380 B
JavaScript
24 lines
380 B
JavaScript
import {
|
|
getToken
|
|
} from './token.js'
|
|
|
|
export const $post = async ({
|
|
url,
|
|
data = {}
|
|
}) => {
|
|
const token = getToken() ? getToken() : '';
|
|
const res = await uni.request({
|
|
url,
|
|
method: 'POST',
|
|
data,
|
|
header: {
|
|
Authorization: 'Bearer ' + token
|
|
}
|
|
});
|
|
if (!!res && res.data != '') {
|
|
return res.data
|
|
} else {
|
|
uni.$lu.toast("请求发生错误")
|
|
return false
|
|
}
|
|
} |