fix: 登录时保存username,修复订单列表无数据
This commit is contained in:
@@ -4,7 +4,8 @@ const BASE_URL = 'https://sales.violin-work.online/api/v1'
|
||||
// 请求拦截器
|
||||
const request = (url, method, data = {}) => {
|
||||
const token = uni.getStorageSync('token')
|
||||
const userInfo = uni.getStorageSync('userInfo') || {}
|
||||
const userId = uni.getStorageSync('userId') || ''
|
||||
const username = uni.getStorageSync('username') || ''
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
@@ -14,8 +15,8 @@ const request = (url, method, data = {}) => {
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': token ? `Bearer ${token}` : '',
|
||||
'X-User-Id': userInfo.userId || '',
|
||||
'X-Username': userInfo.username || ''
|
||||
'X-User-Id': userId,
|
||||
'X-Username': username
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user