mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
correctly handle errors
This commit is contained in:
@@ -32,9 +32,8 @@ app.config([
|
|||||||
var status = response.status;
|
var status = response.status;
|
||||||
if (status == 401) {
|
if (status == 401) {
|
||||||
$injector.get('$state').transitionTo('welcome');
|
$injector.get('$state').transitionTo('welcome');
|
||||||
return $q.reject(response);
|
|
||||||
}
|
}
|
||||||
return response;
|
return $q.reject(response);
|
||||||
};
|
};
|
||||||
|
|
||||||
var promise = function(promise) {
|
var promise = function(promise) {
|
||||||
|
|||||||
@@ -243,12 +243,12 @@ module.factory('CategoryService', ['$resource', '$http', function($resource, $ht
|
|||||||
callback(data);
|
callback(data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
res.refresh = function(callback) {
|
res.refresh = function(success, error) {
|
||||||
res.get(function(data) {
|
res.get(function(data) {
|
||||||
_.merge(res.subscriptions, data);
|
_.merge(res.subscriptions, data);
|
||||||
if (callback)
|
if (success)
|
||||||
callback(data);
|
success(data);
|
||||||
});
|
}, error);
|
||||||
};
|
};
|
||||||
|
|
||||||
res.init();
|
res.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user