From 93bd548b460fc5bae774eb38be296250dad6284d Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Sun, 9 Nov 2014 17:34:48 +0100 Subject: [PATCH] Use promise api for --- src/js/controller/add-account.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/controller/add-account.js b/src/js/controller/add-account.js index 0580601..8eb4083 100644 --- a/src/js/controller/add-account.js +++ b/src/js/controller/add-account.js @@ -20,7 +20,9 @@ var AddAccountCtrl = function($scope, $location, $routeParams, $http) { var domain = $scope.emailAddress.split('@')[1]; var url = cfg.settingsUrl + domain; - $http.get(url).success(function(config) { + return $http.get(url).then(function(res) { + var config = res.data; + $scope.busy = false; $scope.state.login = { mailConfig: config, @@ -39,7 +41,7 @@ var AddAccountCtrl = function($scope, $location, $routeParams, $http) { setCredentials(); } - }).error(function() { + }).catch(function() { $scope.busy = false; $scope.errMsg = 'Error fetching IMAP settings for that email address!'; });