Files
old-domene-svedska/web/src/components/DomainList.js
2017-12-13 13:56:47 +01:00

49 lines
1.0 KiB
JavaScript

import React, { Component } from 'react';
import {getDomains} from '../helpers/api';
import ReactTable from "react-table";
import "react-table/react-table.css";
class DomainList extends Component {
constructor(props){
super(props);
getDomains().then(l => l.text()).then(l => {
let parsedList = JSON.parse(l);
this.setState({domains:parsedList});
});
this.state = {domains:[]};
}
render() {
return (
<div>
<ReactTable
data = {this.state.domains}
columns={[
{
Header: 'Domain name',
accessor: 'domainName',
},
{
Header: 'TLD domain',
accessor: 'tld',
},
{
Header: 'Expiration date',
accessor: 'expirationDate',
}
]}
defaultPageSize={10}
className="-striped -highlight"
/>
<h3> Total : {this.state.domains.length} </h3>
</div>
)
}
}
export default DomainList;