diff --git a/app/scripts/directives/oauth.js b/app/scripts/directives/oauth.js index a5d9690..ce2ff26 100644 --- a/app/scripts/directives/oauth.js +++ b/app/scripts/directives/oauth.js @@ -77,8 +77,8 @@ directives.directive('oauth', [ }; var compile = function() { - $http.get(scope.template, { cache: $templateCache }).success(function(html) { - element.html(html); + $http.get(scope.template, { cache: $templateCache }).then(function(html) { + element.html(html.data); $compile(element.contents())(scope); }); }; @@ -87,8 +87,8 @@ directives.directive('oauth', [ var token = AccessToken.get(); if (token && token.access_token && scope.profileUri) { - Profile.find(scope.profileUri).success(function(response) { - scope.profile = response; + Profile.find(scope.profileUri).then(function(response) { + scope.profile = response.data; }); } }; diff --git a/app/scripts/services/profile.js b/app/scripts/services/profile.js index cc8a22a..4d257fc 100644 --- a/app/scripts/services/profile.js +++ b/app/scripts/services/profile.js @@ -8,8 +8,8 @@ profileClient.factory('Profile', ['$http', 'AccessToken', '$rootScope', function service.find = function(uri) { var promise = $http.get(uri, { headers: headers() }); - promise.success(function(response) { - profile = response; + promise.then(function(response) { + profile = response.data; $rootScope.$broadcast('oauth:profile', profile); }); return promise; diff --git a/dist/oauth-ng.js b/dist/oauth-ng.js index 785f8fa..2cbafcf 100644 --- a/dist/oauth-ng.js +++ b/dist/oauth-ng.js @@ -1,4 +1,4 @@ -/* oauth-ng - v0.4.10 - 2016-05-25 */ +/* oauth-ng - v0.4.10 - 2017-02-23 */ 'use strict'; @@ -684,8 +684,8 @@ profileClient.factory('Profile', ['$http', 'AccessToken', '$rootScope', function service.find = function(uri) { var promise = $http.get(uri, { headers: headers() }); - promise.success(function(response) { - profile = response; + promise.then(function(response) { + profile = response.data; $rootScope.$broadcast('oauth:profile', profile); }); return promise; @@ -898,8 +898,8 @@ directives.directive('oauth', [ }; var compile = function() { - $http.get(scope.template, { cache: $templateCache }).success(function(html) { - element.html(html); + $http.get(scope.template, { cache: $templateCache }).then(function(html) { + element.html(html.data); $compile(element.contents())(scope); }); }; @@ -908,8 +908,8 @@ directives.directive('oauth', [ var token = AccessToken.get(); if (token && token.access_token && scope.profileUri) { - Profile.find(scope.profileUri).success(function(response) { - scope.profile = response; + Profile.find(scope.profileUri).then(function(response) { + scope.profile = response.data; }); } }; diff --git a/test/spec/directives/oauth.js b/test/spec/directives/oauth.js index 13da42a..90362a1 100644 --- a/test/spec/directives/oauth.js +++ b/test/spec/directives/oauth.js @@ -222,7 +222,7 @@ describe('oauth', function() { spyOn(Endpoint, 'redirect'); }); - it('shows the text "Sing In"', function() { + it('shows the text "Sign In"', function() { result = element.find('.logged-out').text(); expect(result).toBe('Sign In'); }); diff --git a/test/spec/services/profile.js b/test/spec/services/profile.js index 0c195c4..dea4bed 100644 --- a/test/spec/services/profile.js +++ b/test/spec/services/profile.js @@ -45,7 +45,7 @@ describe('Profile', function() { }); it('gets the resource', inject(function(Profile) { - Profile.find(params.profileUri).success(function(response) { result = response; }); + Profile.find(params.profileUri).then(function(response) { result = response.data; }); $rootScope.$apply(); $httpBackend.flush(); expect(result.name).toEqual('Alice');