48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import React, { Component } from "react";
|
|
import CompTable from "../common/Tables/CompTable";
|
|
import { callAPI } from "../../actions/API"
|
|
import Error from "../../actions/Error";
|
|
|
|
// Missing parent page,
|
|
// Most of the good stuff is happening in UpcomingSingle, which does the
|
|
// main rendering of the table,
|
|
// may want to eventually do the API call here, to re-use the table
|
|
// instead of duplicating it.
|
|
|
|
class GenericList extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
error: false,
|
|
};
|
|
}
|
|
|
|
renderItems() {
|
|
console.log(this.props.APILINK)
|
|
if (!this.state.error) {
|
|
return <CompTable data={callAPI(this.props.APILINK)} />;
|
|
} else {
|
|
console.log("error");
|
|
return <Error />;
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="row">
|
|
<div className="divider"></div>
|
|
<div className="section">
|
|
<div className="col s12"></div>
|
|
</div>
|
|
<div className="divider"></div>
|
|
<div className="section">
|
|
<div className="col s12">{this.renderItems()}</div>
|
|
</div>
|
|
<div className="divider"></div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default GenericList;
|