u
This commit is contained in:
parent
eae8361b7d
commit
fea3922e00
4
index.js
4
index.js
@ -60,7 +60,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
makeServerUrl(route = '') {
|
||||
if (typeof route !== 'string') route = '' // 防止 route 为 null, undedefined 等由于后台数据库默认值而造成的异常。
|
||||
if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。
|
||||
|
||||
if (/^https?:\/\//.test(route)) {
|
||||
return route
|
||||
@ -97,7 +97,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
// 再次封装 uni.request,输入参数和 uni.request 保持基本一致。主要为了插入 _passtoken,简化 url 的组装,以及输出提示。
|
||||
async request({ method = 'POST', url, header = {}, data = {} }) {
|
||||
async request({ method = 'POST', url = '', header = {}, data = {} }) {
|
||||
url = this.makeServerUrl(url)
|
||||
header._passtoken = uni.getStorageSync('_passtoken')
|
||||
if (method === 'GET') {
|
||||
|
Loading…
Reference in New Issue
Block a user