Skip to content

Commit

Permalink
Wait for clearLocal to end by returning the promise
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Jul 15, 2016
1 parent 3f4bf58 commit d76da02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions www/assets/js/sofia.db.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ S.db.users = {
return response;
});
}else{
return err;
return response;
}
}
});
Expand Down Expand Up @@ -204,7 +204,7 @@ S.db.fiches = {
S.db.fiches.sync(); //Same Db base everything is ok
}else{
console.log("Diff DB Token detected !",remote, local);
S.db.clearLocal().then(function () { //Clear local DB
return S.db.clearLocal().then(function () { //Clear local DB
S.db.localDB = new PouchDB(S.config.db._local_url); //Restart local DB
S.db.fiches.sync(); //Same Db base everything is ok
}).catch(function (err) {
Expand Down

0 comments on commit d76da02

Please sign in to comment.