Archived
Sistemato fvitali
This commit is contained in:
+78
-12
@@ -13,7 +13,6 @@ class fvitali extends React.Component {
|
|||||||
error: null,
|
error: null,
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
items: [],
|
items: [],
|
||||||
headers: null
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ISO_8601parse(a) {
|
ISO_8601parse(a) {
|
||||||
@@ -23,23 +22,17 @@ class fvitali extends React.Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
axios.get('http://site1825.tw.cs.unibo.it/TW/globpop', {
|
axios.get('http://site1825.tw.cs.unibo.it/TW/globpop', {
|
||||||
'params':{
|
'params':{
|
||||||
'id':this.props.videoID
|
'Id':this.props.match.params.id
|
||||||
}
|
}
|
||||||
}).then(
|
}).then(
|
||||||
response => {
|
response => {
|
||||||
//this.shuffleArray(response.data);
|
|
||||||
console.info ('a',response.data);
|
|
||||||
this.getThumbnailsNames(response.data.recommended);
|
this.getThumbnailsNames(response.data.recommended);
|
||||||
console.info(response.data.recommended);
|
console.info('a',response.data.recommended);
|
||||||
// this.setState({
|
// this.setState({
|
||||||
// isLoaded: true,
|
// items: response.data.recommended,
|
||||||
// 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 => {
|
error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.setState({
|
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
|
// METODI
|
||||||
getThumbnailsNames(reccomended) {
|
getThumbnailsNames(reccomended) {
|
||||||
let idToLookFor = reccomended.map(item => item.videoID);
|
let idToLookFor = reccomended.map(item => item.videoID);
|
||||||
|
|||||||
Reference in New Issue
Block a user