bobbe malle

This commit is contained in:
matteo
2018-12-01 03:04:08 +01:00
parent a55cc2d414
commit 2bca56b881
+11 -9
View File
@@ -19,7 +19,8 @@ this.raffina = this.raffina.bind(this);
wikijs()
.page(name)
.then(page => page.fullInfo())
.then(infobox => console.log('infobox', infobox)
.then(
infobox => console.log('infobox', infobox)
//this.setState({ infobox })
);
//console.log('infobox', this.state.infobox)
@@ -35,20 +36,25 @@ this.raffina = this.raffina.bind(this);
// }
componentWillMount() {
wikijs().find(this.props.query, this.raffina).then(data => {
wikijs()
.find(this.props.query, this.raffina)
.then(
data => {
this.setState({
data,
isLoaded: true
});
console.log(data.html());
//this.getWikiBox(data.results[0]);
}, error => {
},
error => {
console.error(error);
this.setState({
isLoaded: true,
error
});
});
}
);
}
// componentWillReceiveProps(nextProps) {
@@ -74,11 +80,7 @@ this.raffina = this.raffina.bind(this);
render() {
const { data, error, isLoaded } = this.state;
if (error) {
return (
<React.Fragment>
Error: {error.message} -- Cannot get {error.config.url}
</React.Fragment>
);
return <React.Fragment>Error: {error.message}</React.Fragment>;
} else if (!isLoaded) {
return <React.Fragment>Loading...</React.Fragment>;
} else {