All Questions
206 questions
1
vote
1
answer
71
views
deckOfCards API wont choose card from the deck with the specific deck ID
I have been stuck on this for so long and the answer is probably so simple but I can't figure it out at all, basically every time I click the button to draw a card its giving me a brand new deck and ...
0
votes
0
answers
327
views
Using a try and catch to await an axios request so I can use the response in another function it´s good practice? [duplicate]
I´m practising React making a web site but I want to consume some APIs. The problem is that I had a problem when making an Axios request since it´s asynchronous, and when I tried calling it in a ...
1
vote
1
answer
26
views
Synchronization problem with fetching data from json-server and show in UI using react?
I can get data from json-server and show in UI but there is a problem that always confusing my mind. Fetching data is an asynchronus process, so when i try to fetch data and set the state, actually ...
-1
votes
1
answer
835
views
VueJS and Axios causing 'error during execution of scheduler flush' and Uncaught (in promise) TypeError
So i have been poking my code for a while and found out that this error is caused specifically by this line of code:
treeNodes.value = documentStore.convertToTree((await axios.get('/File')).data);
...
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
25
views
How to make pararell JS API calls modifying responses simultaneously
I am trying to make multiple pararell api calls (a lot of them) with axios.all and I would like to add new property to the responses at the same time. I would like to add the mapped array values as a &...
-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
1
answer
332
views
Axios request doesn't return a promise / Uncaught TypeError: Cannot read properties of undefined (reading 'then')
I have an api object that I create from axios with this line of code.
const api = axios.create({ baseURL: 'http://localhost:3006' });
Then I export this call with this line of code...
export const ...
0
votes
0
answers
30
views
Defining a variable with a part inside a function [duplicate]
I need help with defining a variable,
I want to make a new variable named mainPendingTotal
I want it to be equal to the pendingTotal if (x.Username == config.mainAccount)
How do I do this? Below is ...
0
votes
1
answer
575
views
Response of last axios-request response is null
I want to get the current weather conditions of a given place. In order to achieve that I used two APIs. The first one is Mapbox, which I used to geocode the place name to geo-coordinates, and the ...
0
votes
1
answer
31
views
Getting returned value from another javascript file using async
class monitor {
constructor(){
this.delay = config.delay
delay(time) {
return new Promise(function (resolve) {
setTimeout(resolve, time);
});
}
...
0
votes
1
answer
8k
views
Is it necessary to check if axios response status is 200 or not?
Is it necessary to check if axios.get() response status is 200 ?
useEffect(() => {
const fetch = async () => {
try {
const response = await axios.get('/api');
if (response....
0
votes
1
answer
110
views
Nodejs multiple axios get requests return a Primise
How to return a Promise from the multiple axios get requests?
I have below code.
async function main() {
const URL_1 = 'abc.com/get1/data1';
const result_1 = await getData(URL_1);
const ...
1
vote
1
answer
264
views
Axios created string returns 403 forbidden since the URL is broken but works fine hardcoded string
Axios created string returns 403 forbidden since the URL is broken when the URL is made by combining several strings.
Here is an example:
This works fine:
const inventory = await axios.get("http:/...
1
vote
2
answers
174
views
VueJs + Axios + D3.js "Error: too late; already running"
I am trying to visualize some data with Vue-d3-charts.
I am getting the data asyncronously with axios.
The problem is that i am having issues with pushing the response data to the chart_data.
Either i ...