title: Cannot GET /teachers/[object%20Object]
body: <p>axios is making or redirecting to this weird url. i don't what's happening. i also check other solutions available here, but no help.
  i also checked it with public api urls, but it's redirecting to same url.<br>
  i'm making request from <code>https://d52890213a1f40e2b2XXXXXXX5ab4e.vfs.cloud9.ap-southeast-1.amazonaws.com:8081/teachers</code></p>
  
  <p>axios method:</p>
  
  <pre><code>export function apiCall(method, url, data) {
      console.log(method, url, data)
      debugger
      return axios[method]({
              url,
              params: { origin: "*" },
              data
          })
          .then(res =&gt; {
              console.log(res);
              return res.data;
          })
          .catch((err) =&gt; {
              if (err.response) {
                  // debugger
                  return Promise.reject(err.response.data);
              }
              else if (err.request) {
                  // debugger
                  return Promise.reject(err);
              }
              else {
                  // debugger
                  return Promise.reject(err);
              }
          });
  }
  </code></pre>
  
  <p>console output</p>
  
  <pre><code>get https://d52890213a1f40e2b2XXXXXXX5ab4e.vfs.cloud9.ap-southeast-1.amazonaws.com:8080/api/questionset undefined
  </code></pre>
  
  <p>calling function</p>
  
  <pre><code>componentDidMount(){
          apiCall('get', `${process.env.REACT_APP_BASE_URL}/api/questionset`)
          // apiCall('get', `https://randomuser.me/api/`, undefined)
              .then(data =&gt;{
                  console.log(data);
                  if(!data.success){
                      throw Error(data.message);
                  }
                  else{
                      this.setState({
                          isLoading: false,
                          questionSets: data.questionSets
                      })
                  }    
              })
              .catch(err=&gt;{
                  debugger
                  console.log(err);
                  this.setState({
                      isLoading: false
                  })
                  return this.props.addError(err.message)
  
              });
      }
  </code></pre>
  
  <p>errors:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Error&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;pre&gt;Cannot GET /teachers/[object%20Object]&lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>