Skip to content

Commit

Permalink
fix(sync): fix promise when no post
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonny committed Feb 25, 2015
1 parent f99df17 commit 84c99f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hubpress/scripts/services/PostsServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ function _getGithubPostsSha(repository, context) {
*/
function _getPostsGithub(repository, context, sha) {
let deferred;
let promise;

if (sha === localStorage.postsSha) {
deferred = Q.fcall(function() {
promise = Q.fcall(function() {
return [];
});
}
else {
deferred = Q.defer();
let deferred = Q.defer();
repository.read(context.branch, '_posts', (err, posts) => {
if (err) {
deferred.reject(err);
Expand All @@ -194,9 +194,10 @@ function _getPostsGithub(repository, context, sha) {
}
});

promise = deferred.promise;
}

return deferred.promise;
return promise;
}

function _filterPostsToSync(db, posts) {
Expand Down

0 comments on commit 84c99f9

Please sign in to comment.