diff options
Diffstat (limited to 'cvp/3rd_party/static/testapi-ui/components/results')
-rw-r--r-- | cvp/3rd_party/static/testapi-ui/components/results/resultsController.js | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js b/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js index 4476618c..0b0bbbc8 100644 --- a/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js +++ b/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js @@ -254,23 +254,28 @@ $http.post(uploadUrl, fd, { transformRequest: angular.identity, headers: {'Content-Type': undefined} - }) - .success(function(data){ + }).then(function(data){ + + if(data.data.code && data.data.code != 0){ + alert(data.data.msg); + return; + } + ctrl.uploadState = ""; - data.filename = file.name; + data.data.filename = file.name; var createTestUrl = testapiApiUrl + "/tests" - $http.post(createTestUrl, data) - .success(function(data, status){ - if (data.code && data.code != 0) { - alert(data.msg); - } else { - ctrl.update(); - } + + $http.post(createTestUrl, data.data).then(function(data){ + if (data.data.code && data.data.code != 0) { + alert(data.data.msg); + } else { + ctrl.update(); + } + }, function(error){ }); - }) - .error(function(data, status){ - ctrl.uploadState = "Upload failed. Error code is " + status; + }, function(error){ + ctrl.uploadState = "Upload failed. Error code is " + error.status; }); } |