Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

76
Views
I tried to use the .map function but it didn't work on my code
async function getCategoryIds ()
{
    let response = axios.get( `${BASE_API_URL}categories?count=100` );
    let catIds = response.data.map( c => c.id );
    return _.samplesize( catIds, NUM_CATEGORIES )  
};

This is my code I tried to change the data in [] but it still don't work

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

The main issue here is you have not used await in your code. adding await like the following should solve your problem -

let response = await axios.get( `${BASE_API_URL}categories?count=100` );
7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.