Archived
Iniziato Recent, Sistemato Navbar
This commit is contained in:
+14
-5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user