Ultimato fvitali

This commit is contained in:
Gregorio
2019-02-18 20:38:37 +01:00
parent 6e2a6c84df
commit 0eaa8eb805
+4 -95
View File
@@ -1,8 +1,5 @@
//http://site1825.tw.cs.unibo.it/TW/globpop fvitali
//http://site1825.tw.cs.unibo.it/video.json originale videolist
import React from 'react';
import { Col, ListGroup, Card, CardDeck } from 'react-bootstrap'; // eslint-disable-line no-unused-vars
import { Col, Card } from 'react-bootstrap'; // eslint-disable-line no-unused-vars
import axios from 'axios'; // eslint-disable-line no-unused-vars
import { Link } from 'react-router-dom'; // eslint-disable-line no-unused-vars
/*eslint no-console: ["error", { allow: ["warn", "error", "info"] }] */
@@ -14,24 +11,16 @@ class fvitali extends React.Component {
isLoaded: false,
items: [],
};
ISO_8601parse(a) {
return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss');
}
componentDidMount() {
axios.get('http://site1825.tw.cs.unibo.it/TW/globpop', {
'params':{
'Id':this.props.match.params.id
'id':this.props.match.params.id //se 'id'=>'Id', allora tutti video random, sennò anche per genere simile
}
}).then(
response => {
this.getThumbnailsNames(response.data.recommended);
console.info('a',response.data.recommended);
// this.setState({
// items: response.data.recommended,
// });
},
error => {
console.error(error);
@@ -43,78 +32,7 @@ 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) {
@@ -151,15 +69,6 @@ class fvitali extends React.Component {
/*shuffleArray(videoarray) {
for (let i = videoarray.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[videoarray[i], videoarray[j]] = [videoarray[j], videoarray[i]]; // eslint-disable-line no-param-reassign
}
// Durstenfeld shuffle.
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
}*/
render() {
const { error, isLoaded, items } = this.state;
if (error) {