title: How can I add my query parameter data -which I use in URL- to my response data?
body: <p>I'm sending a request to get organization data's from API firstly, then ı getting another specific data's -which is <strong>&quot;plants&quot;</strong>- from another API with sending as a parameter <strong>organizationEIC</strong> property of my <strong>organization</strong> data which ı get in the first request. I am doing this to get for each plants of each organizations. What ı want to do is, I need to add <strong>organizationEIC</strong> property which ı use in the URL query to the response data's which are came as a result of my request. Let me make this clear with one <strong>example</strong>;<br />
  I am sending a request like **<a href="https://seffaflik.epias.com.tr/transparency/service/production/dpp-injection-unit-name?organizationEIC=40X000000000104H" rel="nofollow noreferrer">https://seffaflik.epias.com.tr/transparency/service/production/dpp-injection-unit-name?organizationEIC=40X000000000104H</a> and as you can see it responses to me with <strong>5 different plant data</strong>. I need to add the organizationEIC property -which ı use for get this 5- to this 5 response data and save like this to database to record which organization they are affiliated with. In another request with a different organizationEIC code, maybe it gets <strong>2 plant data</strong>, so ı need to add my organizationEIC to this 2 plant data. So how can ı get this data from url to add my result datas in foreach loop?<br />
  I hope ı explained my problem clear and easy to understand. So here is <strong>my codes</strong>;</p>
  <pre><code>var datas = []
  var result = []
  var plantList = []
  class App extends Component {
  
    state = {
      companies: [],
  
      plants: []
    }
  
  
  
    componentDidMount() {
      fetch('https://seffaflik.epias.com.tr/transparency/service/production/dpp-organization', {
        method: &quot;GET&quot;,
        headers: {
          &quot;Content-Type&quot;: &quot;application/json&quot;,
          'X-Requested-With': 'XMLHttpRequest'
        }
      })
        .then(response =&gt;
          response.json())
        .then(async resultJson =&gt; {
          this.setState({
            companies: resultJson.body.organizations,
          })
          await this.getPlants(resultJson.body.organizations)   //first get org. datas and send as param.
        });
    }
    getPlants = async (items) =&gt; {
      const data = await Promise.all(items.map((plant) =&gt; {     //getting plants for each organization
        return fetch(`https://seffaflik.epias.com.tr/transparency/service/production/dpp-injection-unit-name?organizationEIC=${plant.organizationETSOCode}`, {
          method: 'GET',
          headers: {
            &quot;Content-Type&quot;: &quot;application/json&quot;,
            'X-Requested-With': 'XMLHttpRequest'           
          }
        }).then(response =&gt;response.json())              //need some logic for my solution here probably :(
      }))
      data.forEach(element =&gt; {
        datas.push(element.body.injectionUnitNames)
      });
    
      Array.prototype.push.apply(plantList, this.configure(datas))
      this.setState({
        plants: plantList
      })
    }
    
    configure = (units) =&gt; {
      units.forEach((unit) =&gt; {
        unit.forEach((item) =&gt; {
          result.push(item)
        })
      })
      return result
    } 
  </code></pre>
  <p>I am open for any tips and tricks, thx in advance for your helps and advices :)</p>