Iniziato Recent, Sistemato Navbar

This commit is contained in:
Gregorio
2019-02-12 18:58:15 +01:00
parent 4ac7f80d2f
commit 4e906261be
4 changed files with 71 additions and 41 deletions
+14 -5
View File
@@ -93,12 +93,21 @@ class VideoPlayer extends React.Component {
response => console.info(response.data),
error => console.info(error, videoIdWatched.toString())
);
// local storage logic for recent reccomender
let tmp = JSON.parse(localStorage.getItem('lastWatched'))
tmp.push({
// local storage logic for recent reccomender//tmp è il video che devo inserire sulla lista
let tmp = JSON.parse(localStorage.getItem('lastWatched'))
let j=tmp.findIndex(el=>el.id.toString()===videoIdWatched.toString())
if (j<0){
tmp.push({
'id': videoIdWatched.toString(),
'date' : new Date()
});
'lastWatched' : new Date(),
'timesWatched' : 1
});}
else {
tmp[j].timesWatched++;
tmp[j].lastWatched= new Date();
}
localStorage.setItem('lastWatched', JSON.stringify(tmp));
//.finally(()=>{})
clearInterval(timerId1);