mern api route with axios

Asked by At

we are making an app using mern that will populate the page with what ever wine you search for. But i cant get my api route to work.

    loadWines = () => {
      Axios.get("https://services.wine.com/?t=" + wineName + "&y=&apikey=05bd3e5306d43d741a06a939c5ea3dd27eaad377" + this.state.value)
      .then(res=>res.json())
      .then(json => {
        this.setState({
          value: '',
          isLoaded:true,
          Wines:json,
        })
      });
    }

    handleChange(event) {
      this.setState ({value: event.target.value});
    }
      handleSubmit(event) {
        event.preventDefault();

        Axios.get("https://services.wine.com/?t=" + wineName + "&y=&apikey=05bd3e5306d43d741a06a939c5ea3dd27eaad377" + this.state.value)
        .then(res=>res.json())
        .then(json => {
          this.setState({
            value: '',
            isLoaded:true,
            Wines:json,
          })
        });
        console.log(this.state.value)
      }

0 Answers