Display error if error on upload

We were missing the rejected promise when image upload returned
an error. Now with this change and
https://gerrit.openbmc-project.xyz/#/c/9594/ image upload
now uploads an image and refreshes the page to display the image
or displays an error if the upload failed.

Resolves openbmc/openbmc#2960

Tested: See an error if a bad image. GUI refreshes if the image
was uploaded successfully.
Change-Id: I5f4030fb29fc08aa65dd0d36e32368106c31a76b
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 431c7ce..e74b196 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -818,8 +818,7 @@
                 return deferred.promise;
               },
               uploadImage: function(file){
-                var deferred = $q.defer();
-                $http({
+                return $http({
                   method: 'POST',
                   timeout: 5 * 60 * 1000,
                   url: DataService.getHost() + "/upload/image",
@@ -829,15 +828,8 @@
                   withCredentials: true,
                   data: file
                 }).then(function(response){
-                      var json = JSON.stringify(response.data);
-                      var content = JSON.parse(json);
-                      deferred.resolve(content);
-                }, function(error){
-                  console.log(error);
-                  deferred.reject(error);
+                  return response.data;
                 });
-
-                return deferred.promise;
               },
               downloadImage: function(host, filename){
                 return $http({