All Questions
346 questions
0
votes
0
answers
63
views
How to control the order of promise's callback [duplicate]
I have promises like this,
var results_arr = [];
var promises = [];
for (var i = 0 ; i < items.length;i++){
var url = `/api/stat/${items[i].id}`;
promises.push(
...
-3
votes
1
answer
63
views
Axios becomes a promise
The console.log outputs of the api and axios variables in the following code are different, even though I didn't change anything. api is the normal axios but the state axios becomes a Promise.
import {...
1
vote
0
answers
241
views
How to pause promise chain to wait for a button click?
I'm trying to chain some backend calls to process a file, but the entire workflow needs some input from the user midway. I'm not sure how to pause the execution until the user clicks a button to "...
0
votes
1
answer
182
views
Can I return a single error with Promise.allSettled() on a multiple axios post?
I am sending objects with more than one value in the list to a single api, and I have done this in successive objects as follows.
Redux action:
import { axios } from "@lib/axios";
export ...
1
vote
0
answers
134
views
How to retry a specific request in multiple call using axios.all if one is faild
I make calls based on an array using axios and Promise.all,
sometimes there is an element that fails because I make a lot of calls (server problem)
I would like to retry the call for the element that ...
1
vote
2
answers
4k
views
What does "Uncaught (in promise) Object" mean?
I have such an error. How it can be corrected and debugged. I want the code to stop when there is a problem.
My code
export function postRequestOtpCode(phone: string, token: string): ...
-1
votes
1
answer
131
views
Nested API call In function - React-native
I have the following JSON Response. It's in an array format
[{
created: "2017-11-04T18:48:46.250Z"
gender: "Male"
id: 1
image: "https://rickandmortyapi.com/api/character/...
0
votes
0
answers
38
views
Child promise with Promise.all is not waiting for axios.get to complete all the responses and moving to next parent iteration
I have a promise which has child promise in it. when I am running the child promise which has array of urls, and mapping through each of urls to get the response but its not waiting for request to ...
4
votes
2
answers
5k
views
How to run axios interceptor once for multiple request on 401 error?
I have setup for axios and react-query together for my food application . I want to implement refreshing token only once for more than 2 parallel request and retry all the pending failed request . I ...
1
vote
2
answers
1k
views
How to use Promise.all() in for loop?
I have an axios function, which I want to call several times, then I want to firstly sort received data and then store it. But now all my promises results are undefined.
const arr = {...checkbox};
...
0
votes
1
answer
92
views
How to control js promise flow when one function needs only 1 promise resolved and the other needs all promises resolved?
I have 2 web service endpoints that I'm trying to fulfill with promises. What I need to accomplish is once endpoint1 is finished, I need to load some components, and once both endpoint1 and endpoint2 ...
-1
votes
1
answer
195
views
Update and access value from async function in javascript [duplicate]
I'm trying to wrtie an async function that will print a dad joke in the console when i click the button.
const btn = document.querySelector("button");
const getDadJoke = async () => {
...
0
votes
0
answers
611
views
How to make a request call running in the background in JS?
I have the following code:
function getRegionList() {
return new Promise(function(resolve, reject) {
const config: ExtendedAxiosConfig = {
method: "GET",
...
0
votes
0
answers
225
views
Promise.all with "nested" axios request
I'm facing a small problem with Promise.all and axios. I read a lot of documentation on "how to do it", but still I did not get what I want.
Basically, I want to execute multiple axios ...
0
votes
1
answer
266
views
Will the results of a request to the same API be overwritten?
I have two buttons for triggering requests, both of which are data requests to the same API, with different buttons representing different parameters.
For example, button A is requesting data for the ...