Archived
Ultimato fvitali
This commit is contained in:
@@ -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 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 axios from 'axios'; // eslint-disable-line no-unused-vars
|
||||||
import { Link } from 'react-router-dom'; // 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"] }] */
|
/*eslint no-console: ["error", { allow: ["warn", "error", "info"] }] */
|
||||||
@@ -14,24 +11,16 @@ class fvitali extends React.Component {
|
|||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
items: [],
|
items: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
ISO_8601parse(a) {
|
|
||||||
return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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.match.params.id
|
'id':this.props.match.params.id //se 'id'=>'Id', allora tutti video random, sennò anche per genere simile
|
||||||
}
|
}
|
||||||
}).then(
|
}).then(
|
||||||
response => {
|
response => {
|
||||||
this.getThumbnailsNames(response.data.recommended);
|
this.getThumbnailsNames(response.data.recommended);
|
||||||
console.info('a',response.data.recommended);
|
|
||||||
// this.setState({
|
|
||||||
// items: response.data.recommended,
|
|
||||||
// });
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.error(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
|
// METODI
|
||||||
getThumbnailsNames(reccomended) {
|
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() {
|
render() {
|
||||||
const { error, isLoaded, items } = this.state;
|
const { error, isLoaded, items } = this.state;
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user