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); }