Parcourir la source

fix: 视频回看页面,cameraPreview/getList不要携带targetTenantId

louhangfei il y a 1 an
Parent
commit
8eba306165

+ 7 - 4
src/api/camera/camera-preview.ts

@@ -42,10 +42,13 @@ export const getCameraTree = (param?: CameraQueryForm) => {
 };
 // 适用于Playback.vue/CameraTreeOldVersion.vue
 export const getCameraTreeOldVersion = () => {
-  return http.request<CameraTree[]>({
-    url: '/cameraPreview/getList',
-    method: 'get',
-  });
+  return http.request<CameraTree[]>(
+    {
+      url: '/cameraPreview/getList',
+      method: 'get',
+    },
+    { ignoreTargetTenantId: true },
+  );
 };
 
 /** 算法是否启用 */

+ 2 - 1
src/utils/http/axios/index.ts

@@ -210,6 +210,7 @@ const transform: AxiosTransform = {
     const token = userStore.getToken;
     const tenantId = userStore.getTenantId;
     const targetTenantId = getValue();
+
     if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
       // jwt token
       (config as Recordable).headers.satoken = options.authenticationScheme
@@ -220,7 +221,7 @@ const transform: AxiosTransform = {
     if (tenantId) {
       (config as Recordable).headers.tenantId = tenantId;
     }
-    if (targetTenantId) {
+    if (!(config as Recordable)?.requestOptions?.ignoreTargetTenantId && targetTenantId) {
       (config as Recordable).headers.targetTenantId = targetTenantId;
     }
 

+ 2 - 0
src/utils/http/axios/types.ts

@@ -55,6 +55,8 @@ export interface RequestOptions {
   ignoreCancelToken?: boolean;
   // 是否携带token
   withToken?: boolean;
+  /**  是否忽略targetTenantId,默认不忽略*/
+  ignoreTargetTenantId?: boolean;
 }
 
 export interface Result<T = any> {