diff --git a/src/TopBar.js b/src/TopBar.js index 36bb62d..c0720de 100644 --- a/src/TopBar.js +++ b/src/TopBar.js @@ -37,50 +37,70 @@ class TopBar extends Component {
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); diff --git a/src/index.js b/src/index.js index df845de..13a257d 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,10 @@ import ReactDOM from 'react-dom'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; import { HashRouter, BrowserRouter } from 'react-router-dom'; // eslint-disable-line +<<<<<<< HEAD +======= +>>>>>>> 4e906261be5bde911e46316a11ba0ec25de00fe8 localStorage['lastWatched'] ? function (){}() : localStorage.setItem('lastWatched', JSON.stringify([])) localStorage['lastId'] ? function (){}() : localStorage.setItem('lastId','0J2QdDbelmY') diff --git a/src/reccomenders/popGlobaleAssoluta.js b/src/reccomenders/popGlobaleAssoluta.js index cc9b921..87d9c06 100644 --- a/src/reccomenders/popGlobaleAssoluta.js +++ b/src/reccomenders/popGlobaleAssoluta.js @@ -24,6 +24,7 @@ class popGlobaleAssoluta extends React.Component { // let listSiti = ['1828', '1829', '1838', '1839', '1846', '1822', '1847', '1831', '1827', '1848', '1824', '1830', '1836', '1850', '1849', '1851', '1861', '1823', '1863', '1834', '1904', '1906', '1901', '1862', '1859']; +<<<<<<< HEAD let listSiti = ['1828', '1838', '1839', '1846', '1847', '1831', '1827', '1849', '1823', '1863', '1834', '1901', '1859']; let axiosReq = []; for(let i=0; i { + axios.get(`http://site${sito}.tw.cs.unibo.it/globpop`, { + 'params': { + 'id': this.props.match.params.id + } + }) + })).then( res=>{console.log(listSiti) + console.log(res.data)} + + + ) + } +>>>>>>> 4e906261be5bde911e46316a11ba0ec25de00fe8 // METODI getThumbnailsNames(reccomended) {