|
|
@@ -1,14 +1,12 @@
|
|
|
-import { merge } from 'lodash'
|
|
|
+import {merge} from 'lodash'
|
|
|
import configs from '@/config'
|
|
|
-import { Axios } from './axios'
|
|
|
-import { ContentTypeEnum, RequestCodeEnum, RequestMethodsEnum } from '@/enums/requestEnums'
|
|
|
-import type { AxiosHooks } from './type'
|
|
|
-import { clearAuthInfo, getToken,getUserId,getBrandId,getHouseId } from '../auth'
|
|
|
+import {Axios} from './axios'
|
|
|
+import {ContentTypeEnum, RequestCodeEnum, RequestMethodsEnum} from '@/enums/requestEnums'
|
|
|
+import type {AxiosHooks} from './type'
|
|
|
+import {clearAuthInfo, getBrandId, getHouseId, getShopId, getToken, getUserId} from '../auth'
|
|
|
import feedback from '../feedback'
|
|
|
import NProgress from 'nprogress'
|
|
|
-import { AxiosError, type AxiosRequestConfig } from 'axios'
|
|
|
-import router from '@/router'
|
|
|
-import { PageEnum } from '@/enums/pageEnum'
|
|
|
+import {AxiosError, type AxiosRequestConfig} from 'axios'
|
|
|
|
|
|
// 处理axios的钩子函数
|
|
|
const axiosHooks: AxiosHooks = {
|
|
|
@@ -20,6 +18,7 @@ const axiosHooks: AxiosHooks = {
|
|
|
const userId = getUserId();
|
|
|
const brandId = getBrandId();
|
|
|
const houseId = getHouseId();
|
|
|
+ const shopId = getShopId();
|
|
|
headers['userId'] = userId || ""
|
|
|
headers['brandId'] = brandId || ""
|
|
|
headers['houseId'] = houseId || ""
|
|
|
@@ -38,6 +37,7 @@ const axiosHooks: AxiosHooks = {
|
|
|
config.data = params
|
|
|
config.data.brandId = brandId
|
|
|
config.data.houseId = houseId
|
|
|
+ config.data.shopId = shopId
|
|
|
config.params = {}
|
|
|
}
|
|
|
// 如果是GET请求,将brandId和houseId添加到params中
|
|
|
@@ -45,7 +45,8 @@ const axiosHooks: AxiosHooks = {
|
|
|
config.params = {
|
|
|
...config.params,
|
|
|
brandId: brandId,
|
|
|
- houseId: houseId
|
|
|
+ houseId: houseId,
|
|
|
+ shopId: shopId
|
|
|
}
|
|
|
}
|
|
|
config.headers = headers
|