import React, {Component} from 'react'; import './MainPane.scss'; import Connections from "./Connections"; import ConnectionContent from "../components/ConnectionContent"; import {withRouter} from "react-router-dom"; import axios from 'axios'; class MainPane extends Component { constructor(props) { super(props); this.state = { selectedConnection: null }; } componentDidMount() { if ('id' in this.props.match.params) { const id = this.props.match.params.id; axios.get(`/api/connections/${id}`).then(res => { if (res.status === 200) { this.setState({selectedConnection: res.data}); } }); } } render() { return (
this.setState({selectedConnection: c})} />
); } } export default withRouter(MainPane);