how can i list and filter 2 axion.get?

Viewed 28

hello somebody can help me please ? i'm trying to add my secondRequest to my types because i'm Parser my data in a console but if i try like in the example it only show me the firstRequest not both together like i want

  const firstRequest = await axios.get(`${fox.url}/nodes/${firstFolderId}/children`, PARAMS);
  const secondRequest = await axios.get(`${fox.url}/nodes/${secondFolderId}/children`, PARAMS);


 const types = _(firstRequest.data.list.entries).filter((type) => !type.entry.name.includes('dog'),
      secondRequest.data.list.entries).filter((type) => !type.entry.name.includes('cat');
    
      const resourcesTypes = getParserTypes(types, subject);
    
      
      console.log("resourcesTypes",resourcesTypes)

it only show me the firstRequest

const types = _(firstRequest.data.list.entries).filter((type) => !type.entry.name.includes('dog'),
      secondRequest.data.list.entries).filter((type) => !type.entry.name.includes('cat');
1 Answers

Replace the const types line with the following and try again.

const types =  _(firstRequest.data.list.entries).filter((type) =>
 !type.entry.name.includes('dog'),
_(secondRequest.data.list.entries).filter((type) => 
    !type.entry.name.includes('cat');
Related