sistemato popRelLoc.js

This commit is contained in:
Gregorio
2019-03-03 20:54:26 +01:00
parent d9d6138fd9
commit 8475cb4ca8
+11 -5
View File
@@ -18,11 +18,17 @@ class PopRelLoc extends React.Component {
}
componentDidMount() {
let tmp = JSON.parse(localStorage.getItem('lastWatched'));
let j = tmp.findIndex(el => el.id === localStorage["lastId"]);
//this.getThumbnailsNames(tmp[j].prevVideos);
if (tmp.length === 0 || localStorage["prevId"] === '1') { this.getThumbnailsNames(JSON.parse(localStorage.getItem('first'))) }
else { this.getThumbnailsNames(tmp[j].prevVideos) }
axios.get("http://site1854.tw.cs.unibo.it/videotrack",{
params: {
"prevId" : localStorage['lastId']
}
}).then(res=>{
this.getThumbnailsNames(res.data)
this.setState({
items : res.data
})
},
error=>console.error(error))
}