import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import { Modal, Button } from 'react-bootstrap'; import Axios from 'axios'; import { toast } from 'react-toastify'; export default class TableRow extends Component { constructor(props) { super(props) this.state = { data: this.props.data, show: false, } } toggleShow = () => { var show = this.state.show; if(show) { this.setState({ show: false }); } else { this.setState({ show: true }); } } delete = (id) => { var url = 'api/speedtest/delete/' + id; Axios.delete(url) .then((resp) => { console.log(resp); toast.success('Speedtest deleted'); }) .catch((err) => { if(err.response.status == 404) { toast.warning('Speedtest not found'); } else { toast.error('Something went wrong'); } }) this.props.refresh(); this.toggleShow(); } render() { var e = this.state.data; var show = this.state.show; if(e.failed != true) { return (
Server ID: {e.server_id}
Name: {e.server_name}
Host: {e.server_host}
URL: Speedtest.net
{e.scheduled != undefined &&Type: {e.scheduled == true ? 'scheduled' : 'manual'}
}