correctly handle errors

This commit is contained in:
Athou
2014-08-19 01:12:19 +02:00
parent fed74f05fc
commit f56cba59ae
2 changed files with 5 additions and 6 deletions

View File

@@ -32,9 +32,8 @@ app.config([
var status = response.status;
if (status == 401) {
$injector.get('$state').transitionTo('welcome');
return $q.reject(response);
}
return response;
return $q.reject(response);
};
var promise = function(promise) {

View File

@@ -243,12 +243,12 @@ module.factory('CategoryService', ['$resource', '$http', function($resource, $ht
callback(data);
});
};
res.refresh = function(callback) {
res.refresh = function(success, error) {
res.get(function(data) {
_.merge(res.subscriptions, data);
if (callback)
callback(data);
});
if (success)
success(data);
}, error);
};
res.init();