diff --git a/src/App.js b/src/App.js index 9f56a54..021c2d6 100644 --- a/src/App.js +++ b/src/App.js @@ -79,7 +79,7 @@ static getDerivedStateFromProps(nextProps, prevState) { - + diff --git a/src/index.js b/src/index.js index 620df3b..df845de 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,8 @@ import ReactDOM from 'react-dom'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; import { HashRouter, BrowserRouter } from 'react-router-dom'; // eslint-disable-line -localStorage.setItem('lastWatched', JSON.stringify([])) + +localStorage['lastWatched'] ? function (){}() : localStorage.setItem('lastWatched', JSON.stringify([])) localStorage['lastId'] ? function (){}() : localStorage.setItem('lastId','0J2QdDbelmY') ReactDOM.render(, document.getElementById('root')); diff --git a/src/reccomenders/popGlobaleAssoluta.js b/src/reccomenders/popGlobaleAssoluta.js index b3fffef..cc9b921 100644 --- a/src/reccomenders/popGlobaleAssoluta.js +++ b/src/reccomenders/popGlobaleAssoluta.js @@ -12,24 +12,34 @@ class popGlobaleAssoluta extends React.Component { headers: null }; - ISO_8601parse(a) { - return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss'); - } - componentDidMount() { + // listSiti.map( + // sito => + // axios.get(`http://site${sito}.tw.cs.unibo.it/globpop`, { + // 'params': { + // 'id': this.props.match.params.id + // } + // }) + // ) + + // 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']; - let listSiti = ['1828', '1838', '1839', '1846', '1847', '1831', '1827', '1848',, '1849', '1851', '1823', '1863', '1834', '1904', '1901', '1862', '1859']; - axios.all(listSiti.map(sito => { - axios.get(`http://site${sito}.tw.cs.unibo.it/globpop`, { + let listSiti = ['1828', '1838', '1839', '1846', '1847', '1831', '1827', '1849', '1823', '1863', '1834', '1901', '1859']; + let axiosReq = []; + for(let i=0; i{console.log(res.data)} - - - ) - } + })) + } + Promise.all(axiosReq) + .then(axios.spread((...res) => { + console.log(res.map(x=>x.data)) + }) + ) + } // METODI getThumbnailsNames(reccomended) { @@ -65,18 +75,7 @@ class popGlobaleAssoluta extends React.Component { } - - /*shuffleArray(videoarray) { - for (let i = videoarray.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [videoarray[i], videoarray[j]] = [videoarray[j], videoarray[i]]; // eslint-disable-line no-param-reassign - } - // Durstenfeld shuffle. - // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm - }*/ - render() { - const ISO_8601parse = this.ISO_8601parse; const { error, isLoaded, items, headers } = this.state; if (error) { return (