Browse Source

fix random queries after getAllFiles refactor

canon
Hazel Levine 3 years ago
parent
commit
08ace76974
  1. 6
      src/imagefile.js

6
src/imagefile.js

@ -25,10 +25,6 @@ function getAllFiles(collection, cb) {
collection.find({}, (err, buns) => {
files = buns;
/* buns.forEach((bun) => {
// let fin = bun.path.replace("public/", "");
files.push(bun);
}); */
cb(files);
});
}
@ -53,7 +49,7 @@ router.getImageRandom = (callback) => {
let file = '';
getAllFiles(Image, (filesOut) => {
file = filesOut[Math.floor(Math.random()*filesOut.length)];
callback(file);
callback(file.path.replace('public/', ''));
});
}

Loading…
Cancel
Save