import React from 'react';
import superagent from 'superagent';
import { fromUnixTime } from "date-fns";
import { formatInTimeZone } from 'date-fns-tz'
import { Table, Segment, Button, Modal, Header, Message, Icon } from 'semantic-ui-react'
import { DEFAULT_TIMEZONE } from '../../CloudApi/Constants.js';
export default class SocialBlockList extends React.Component {
constructor(props) {
super(props);
this.state = {
blocked: [],
pendingGraphItemId: null,
showDialog: false
};
}
async componentDidMount() {
return this.reload();
}
async reload() {
this.setState({ loading: true });
try {
this.setState({ blockeds: [] });
const res = await superagent.get(`/cloud/admin/account/${this.props.account.id}/social/graph/blocked`).accept('json');
console.log(res.body);
this.setState({ blockeds: res.body.items });
} catch (e) {
console.log(e);
}
this.setState({ loading: false });
}
onShowDialog(pendingGraphItemId, e) {
e.preventDefault();
this.setState({showDialog: true, pendingGraphItemId });
}
closeDialog(e) {
this.setState({showDialog: false, pendingGraphItemId: null });
}
async onConfirmDeleteBlockEntry(e) {
e.preventDefault();
try {
const result = await superagent.delete(`/cloud/admin/social/graph/${this.state.pendingGraphItemId}`).accept('json');
this.setState({ showDialog: false, pendingGraphItemId: null });
await this.reload();
} catch (e) {
this.setState({ showDialog: false, pendingGraphItemId: null });
console.log(e);
}
}
render() {
if (this.state.loading) {
return
Are you sure you want to do this?