异常处理
This commit is contained in:
@@ -40,9 +40,11 @@ function getCompanyId() {
|
||||
}
|
||||
|
||||
function setCompanyId(companyId: string) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
if(getApp()?.globalData) {
|
||||
getApp().globalData!.companyId = companyId;
|
||||
if(companyId) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
if(getApp()?.globalData) {
|
||||
getApp().globalData.companyId = companyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import type { HttpError, HttpRequestConfig, HttpResponse } from 'uview-plus/libs/luch-request';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getCompanyId, getToken } from '@/utils/auth';
|
||||
import { showMessage } from '@/utils/request/status';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
@@ -22,7 +22,7 @@ function requestInterceptors() {
|
||||
const token = getToken();
|
||||
if(token && config.header) {
|
||||
config.header.token = token;
|
||||
config.header.companyid = getApp().globalData?.companyId;
|
||||
config.header.companyid = getCompanyId();
|
||||
|
||||
// config.header.contentType = "x-www-form-urlencoded"
|
||||
}
|
||||
|
Reference in New Issue
Block a user