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() { componentDidMount() {
let tmp = JSON.parse(localStorage.getItem('lastWatched')); axios.get("http://site1854.tw.cs.unibo.it/videotrack",{
let j = tmp.findIndex(el => el.id === localStorage["lastId"]); params: {
//this.getThumbnailsNames(tmp[j].prevVideos); "prevId" : localStorage['lastId']
if (tmp.length === 0 || localStorage["prevId"] === '1') { this.getThumbnailsNames(JSON.parse(localStorage.getItem('first'))) } }
else { this.getThumbnailsNames(tmp[j].prevVideos) } }).then(res=>{
this.getThumbnailsNames(res.data)
this.setState({
items : res.data
})
},
error=>console.error(error))
} }