From 13adca8f578140af4cec69d15b7f14a00158a4cf Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 18 Mar 2021 16:05:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E6=B2=A1=E6=9C=89=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=97=B6=E5=88=9D=E5=A7=8B=E6=B7=BB=E5=8A=A0=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/case/ApiCaseList.vue | 6 ++++-- .../components/api/definition/components/list/ApiList.vue | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 5318d26e01..be73f0e974 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -222,7 +222,9 @@ } this.result = this.$post("/api/testcase/list", this.condition, response => { - this.apiCaseList = response.data; + if(response.data){ + this.apiCaseList = response.data; + } this.apiCaseList.forEach(apiCase => { if (apiCase.tags && apiCase.tags.length > 0) { apiCase.tags = JSON.parse(apiCase.tags); @@ -236,7 +238,7 @@ } }) - if (!this.useEnvironment && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) { + if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) { this.useEnvironment = this.apiCaseList[0].request.useEnvironment; this.environment = this.useEnvironment; } diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 3ae913db9d..cdc386be99 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -524,7 +524,8 @@ export default { this.$emit('editApi', row); }, runApi(row) { - let request = JSON.parse(row.request); + + let request = row ? JSON.parse(row.request) : {}; if (row.tags instanceof Array) { row.tags = JSON.stringify(row.tags); }