Fetching data from two different API calls on getInitialProps #13915
-
Hi, I'm relatively new to next.js and web development. I'm currently working on one of my app where I have an API call in _app.js for server side data fetching. I would also like to add an additional API call to fetch some data from another route ('/api/tickets'). I was trying to approach this solution #7193 ,but I cannot get it to working. My code from _app.js looks like this:
Where I'm fetching data from '/api/users/currentuser' . How could I add an another API call to run them both concurrently? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
#7193 (comment) is definitely the way to go for parallel promises. Start smaller, don't run them in parallel, run them in serie like you'd normally do and once you get it working try it parallel, playing with parallel promises is a bit harder. |
Beta Was this translation helpful? Give feedback.
#7193 (comment) is definitely the way to go for parallel promises.
Start smaller, don't run them in parallel, run them in serie like you'd normally do and once you get it working try it parallel, playing with parallel promises is a bit harder.