소스 검색

fix: 添加问号

sun-chaochao 3 년 전
부모
커밋
652a04e6db
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      src/pages/Northbound/AliCloud/service.ts

+ 5 - 6
src/pages/Northbound/AliCloud/service.ts

@@ -1,7 +1,6 @@
 import BaseService from '@/utils/BaseService';
 import { request } from 'umi';
 import SystemConst from '@/utils/const';
-
 class Service extends BaseService<AliCloudType> {
   // 获取服务地址的下拉列表
   public getRegionsList = (params?: any) =>
@@ -9,7 +8,7 @@ class Service extends BaseService<AliCloudType> {
       method: 'GET',
       params,
     }).then((resp: any) => {
-      return resp.result?.map((item: any) => ({
+      return (resp?.result || []).map((item: any) => ({
         label: item.name,
         value: item.id,
       }));
@@ -20,9 +19,9 @@ class Service extends BaseService<AliCloudType> {
       method: 'POST',
       data,
     }).then((resp: any) => {
-      return resp.result.data?.map((item: any) => ({
-        label: item.productName,
-        value: item.productKey,
+      return (resp?.result?.data || []).map((item: any) => ({
+        label: item?.productName,
+        value: item?.productKey,
       }));
     });
 
@@ -32,7 +31,7 @@ class Service extends BaseService<AliCloudType> {
       method: 'POST',
       data,
     }).then((resp: any) => {
-      return resp.result?.map((item: any) => ({
+      return (resp?.result || []).map((item: any) => ({
         label: item.name,
         value: item.id,
       }));