Archived
Sistemato fvitali
This commit is contained in:
+78
-12
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user