I want the function that fetches data to return a certain value

I am trying to return the data fetched by the function getData() and use the returned value to render the StreamerContainerResult component.

However, it keeps returning “undefined” and as a result, I cant render anything..

I am stuck on this bug for the past few hours and I cant figure it out on my own.. Any help would be highly appreciated. Thank you.

 getData(value, type) {
    let streamerData = [];

    let urls = ['https://wind-bow.gomix.me/twitch-api/streams/' + value, 'https://wind-bow.gomix.me/twitch-api/users/' + value];

    const getJson = url => fetch(url).then(res => res.json());
    Promise.all(urls.map(getJson))
      .then((values) => {
        if (type === "search") {
          this.setState({
            streamer: values
          });
          console.log("searching");
        }
      else {
      console.log("displaying");
  return this.getStreamer(values[0],values[1]);
      }
      }).catch(err => {
        console.log('Something went wrong...')
      });
  } 

https://codepen.io/brood915/pen/OWQpmy?editors=0110


Source: stackoverflow-javascript