Answers for "axios get request javascript stackoverflow"

0

axios get request javascript stackoverflow

constructor(props) {
        super(props);
        this.state = {
            clients: [],
            Code: props.match.params.Code
        };
componentDidMount() {
        axios.get('http://localhost:4000/app/viewclient/' + this.props.match.params.Code).then(function(response) {
            if (response.status >= 400) {
                throw new Error("Bad response from server");
            }
            return response.json();
        }).then(function(data) {
            if (data === "success") {
                this.setState({ msg: "User has been deleted." });
            }
        }).catch(function(err) {
            console.log(err)
        });
    }
Posted by: Guest on September-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language