one at time

This commit is contained in:
matteo
2019-03-03 18:55:00 +01:00
parent bb67bb1697
commit 3a4a0e84c7
3 changed files with 24 additions and 17 deletions
+13 -8
View File
@@ -79,14 +79,19 @@ low(new FileAsync(__dirname + '/db.json')) // production
'Access-Control-Allow-Origin': '*'
});
const videos = db.get('videos');
if (req.query.prevId){
let tmp=videos.map(el=>el.id.reason.map(el=>el.reason.map(el2=>{
if(el2.prevId===req.query.prevId){
return {...el2, 'id':this.id}
}
},el)));
res.send(tmp)}
else{res.send(videos)}
if (req.query.prevId) {
let tmp = videos.map(el => el.id.reason.map(el =>
el.reason.map(el2 => {
if (el2.prevId === req.query.prevId) {
return ({ ...el2, 'id': this.id })
}
return {}
}, el)));
res.send(tmp)
}
else {
res.send(videos)
}
});
// POST /videotrack