import React, { Component } from 'react';
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
import { EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStateVariant, Bullseye, Title } from '@patternfly/react-core';
import { ErrorCircleOIcon } from '@patternfly/react-icons'
class NewsBoard extends Component {
normalize(data) {
return data.map(function (element) {
return {
cells: [element.timestamp, element.title]
}
});
}
componentDidMount() {
fetch(`http://${process.env.REACT_APP_GW_ENDPOINT}/news`)
.then(res => res.json())
.then((data) => {
this.setState({ rows: this.normalize(data) });
})
.catch(console.log)
}
constructor(props) {
super(props);
this.state = {
columns: ['Timestamp', 'Story'],
rows: [{
heightAuto: true,
cells: [
{
props: { colSpan: 2 },
title: (