Method: 'GET' how should I do to get my search bar work?

Viewed 14

Hi guy how should i modified the code to get my search bar actually work? currently my search bar not work correctly.

This is the result of my project

async   onSearch_new(value){
console.log(value);
const {taoBao} = this.state
const url = 'http://rap2api.taobao.org/app/mock/250089/testCompanies'
const response = await fetch(url, {
  method: 'GET',//GET,POST,PUT,DELETE,ETC.
  mode: 'cors',//no-cors, cors, same-origin
  cache: 'no-cache',
  credentials: 'same-origin',
  headers: {
    'Content-Type': 'application/json'
  },
  redirect: 'follow',
  referrerPolicy: 'no-referrer',
   //body: JSON.stringify({
   // company: value.company
  //})
});
response.json().then((data) => {
  console.log(data);
  if (data && data.code == 0) {
    this.setState({
      taoBao: taoBao
    })
  }
  else {
    Next.Notification.error({
      title: 'Fail',
      style: {
        width: 600,
        marginLeft: -255
      }
    });
  }
})
0 Answers
Related