import React from 'react'; import superagent from 'superagent'; import { fromUnixTime } from "date-fns"; import { formatInTimeZone } from 'date-fns-tz' import { Table, Segment } from 'semantic-ui-react' import { DEFAULT_TIMEZONE } from '../../CloudApi/Constants.js'; export default class SocialNotifications extends React.Component { constructor(props) { super(props); this.state = { notifications: [], }; } async componentDidMount() { this.setState({ loading: true }); try { this.setState({ notifications: [] }); const res = await superagent.get(`/cloud/admin/account/${this.props.account.id}/social/notifications`).accept('json'); console.log(res.body.items); this.setState({ notifications: res.body.items }); } catch (e) { console.log(e); } this.setState({ loading: false }); } render() { if (this.state.loading) { return   } if (this.state.notifications) { const notifications = _.orderBy(this.state.notifications, ["createdAt"], ["desc"]); return (
Date Sender Type Status Title {notifications.map(notification => { return ( {formatInTimeZone(fromUnixTime(notification.createdAt / 1000), DEFAULT_TIMEZONE, 'yyyy-MM-dd HH:mm:ss zzz')} {notification.senderBigscreenAccountId} {notification.notificationType} {notification.notificationStatus} {notification.title} ) })}
); } else { return null; } } }