don't use the store until it's ready to be used

This commit is contained in:
ansuz
2016-08-02 12:11:40 +02:00
parent fffa9acf15
commit 600f3151e9
6 changed files with 99 additions and 32 deletions

View File

@@ -112,22 +112,26 @@ define([
});
};
Cryptpad.getRecentPads(function (err, recentPads) {
if (err) {
console.log("unable to get recent pads");
console.error(err);
return;
}
Cryptpad.ready(function () {
console.log("ready");
Cryptpad.getRecentPads(function (err, recentPads) {
console.log(recentPads);
if (err) {
console.log("unable to get recent pads");
console.error(err);
return;
}
if (recentPads.length) {
recentPads.sort(Cryptpad.mostRecent);
makeRecentPadsTable(recentPads);
}
if (recentPads.length) {
recentPads.sort(Cryptpad.mostRecent);
makeRecentPadsTable(recentPads);
}
if (hasRecent) {
$('table').attr('style', '');
$tryit.text(Messages.recentPads);
}
if (hasRecent) {
$('table').attr('style', '');
$tryit.text(Messages.recentPads);
}
});
});
});