Sistemato fvitali

This commit is contained in:
Gregorio
2019-02-18 19:33:35 +01:00
parent 8057a99947
commit 6e2a6c84df
+78 -12
View File
@@ -13,7 +13,6 @@ class fvitali extends React.Component {
error: null,
isLoaded: false,
items: [],
headers: null
};
ISO_8601parse(a) {
@@ -23,23 +22,17 @@ class fvitali extends React.Component {
componentDidMount() {
axios.get('http://site1825.tw.cs.unibo.it/TW/globpop', {
'params':{
'id':this.props.videoID
'Id':this.props.match.params.id
}
}).then(
response => {
//this.shuffleArray(response.data);
console.info ('a',response.data);
response => {
this.getThumbnailsNames(response.data.recommended);
console.info(response.data.recommended);
// this.setState({
// isLoaded: true,
// items:response.data.recommended,
console.info('a',response.data.recommended);
// this.setState({
// items: response.data.recommended,
// });
},
// Note: it's important to handle errors here
// instead of a catch() block so that we don't swallow
// exceptions from actual bugs in components.
error => {
console.error(error);
this.setState({
@@ -50,6 +43,79 @@ class fvitali extends React.Component {
);
}
// DIDUPDATE ORIGINALE
// componentDidUpdate(prevProps,prevState){
// if (prevProps.match.params.id !== this.props.match.params.id){
// axios.get('http://site1825.tw.cs.unibo.it/TW/globpop',{
// params:{
// 'Id':this.props.match.params.id
// }
// }).then(
// response => {
// //console.info('a',response.data.recommended);
// // this.setState({
// // items: response.data.recommended,
// // })
// },
// error => {
// console.error(error);
// }
// )
// }
// }
// VERSIONE COPIATA DA RELATED.JS
// componentDidMount() {
// axios.get("http://site1825.tw.cs.unibo.it/TW/globpop",{
// params:{
// // 'part': 'snippet',
// 'Id' : this.props.match.params.id,
// // 'type' : 'video',
// //'key': 'AIzaSyA21Odw9UdfiOJnxvA_eDfOW0OxuUfHKig'
// }
// }).then(
// response => {
// this.getThumbnailsNames(response.data.recommended);
// console.info ('a',response.data);
// this.setState({
// items: response.data.items,
// })
// },
// error => {
// console.error(error);
// }
// )
// }
// componentDidUpdate(prevProps,prevState){
// if (prevProps.match.params.id !== this.props.match.params.id){
// axios.get("http://site1825.tw.cs.unibo.it/TW/globpop",{
// params:{
// // 'part': 'snippet',
// 'Id' : this.props.match.params.id,
// // 'type' : 'video',
// // 'key': 'AIzaSyA21Odw9UdfiOJnxvA_eDfOW0OxuUfHKig'
// }
// }).then(
// response => {
// this.setState({
// items: response.data.items,
// })
// },
// error => {
// console.error(error);
// }
// )
// }
// }
// METODI
getThumbnailsNames(reccomended) {
let idToLookFor = reccomended.map(item => item.videoID);