Questions tagged [axios]

a promise based HTTP client for the browser and node.js

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

Effective cache solution to have the newest data in React Native

Goal We have an app with different articles. I want to cache an article when the user has read it, but make sure that I display the latest data. I came up with this hook: ...
user avatar
  • 101
0 votes
1 answer
143 views

Upload multiple images using react and axios

I trying to upload multiple images about (5000 of size upto 50mb) and trying to figure out what would be the best way to do it. right now i have this code: ...
user avatar
  • 101
0 votes
1 answer
121 views

How to deal with nested callbacks in a clean way?

I am currently migrating some code from class-based components to function components using hooks in React. Where I have come across a piece of code that works as expected but there are 3 Axios calls ...
user avatar
  • 139
3 votes
1 answer
230 views

A React - Typescript custom hook for any request (GET, POST, PUT, DELETE) to my back end

I'm building a full stack exercise app and some of my objects include routines, exercises, exercise sets etc. Instead of writing out specific get, post, put and delete requests for each resource, I ...
user avatar
  • 33
7 votes
2 answers
430 views

Take postcodes and get the Lat long information from them

I had an interview task which was the final stage, however, the feedback I got back for my solution was that it lacked effort and structure. I would be grateful to ...
user avatar
3 votes
0 answers
71 views

Which one should I choose for simple task: async/await or promise.then?

I made a helper function for drawing the map(OpenLayers). Then I made another helper function for fetch(axios.get) the map URL. ...
user avatar
  • 31
7 votes
1 answer
247 views

How do I refactor this fetch request?

I have this code that fetches data from a 3rd party api and sends it to my backend to be processed. The 3rd party api needs to target the user's localhost address so it has to come from the front end. ...
user avatar
4 votes
1 answer
578 views

Access token regeneration for Axios requests

Description I've developed an application which use axios to communicate with the PayPal API. PayPal has a NodeJS SDK, but unfortunately this doesn't support the ...
user avatar
  • 137
0 votes
1 answer
119 views

Getting data from API every x seconds and store it in a database

I'm currently getting data from an API every 15 seconds. This data contains a json with 100-2000 new items every time. Now i don't need all the items that are in there but still quite some of them and ...
user avatar
1 vote
0 answers
467 views

Maintaining current session across multiple requests

I am trying to migrate from request to axios, since request has been deprecated. Suppose that the URL 'https://www.example.com' receives a post request with formdata that contains login information, ...
user avatar
  • 119
4 votes
1 answer
4k views

Disabling a form button while there's an http request running

I have a form built with react, formik and yup, and this form has some async validations. Apparently, some users were able to bypass these validations, and to prevent some errors, I wanted to disable ...
user avatar
2 votes
0 answers
64 views

Reduce repetition in these Redux CRUD actions

My React application manages some entities. I'm using Redux (with redux-thunk) to manage the application state. I've created a RESTClient based on Axios: ...
user avatar
  • 147
-1 votes
1 answer
600 views

Try-catch-finally snippet [closed]

Using visual studio I created a snippet which helps me surround my already written or new code into a try-catch-finally block. I use axios for REST so there had to be separate error handling method so ...
user avatar
  • 169
3 votes
1 answer
233 views

multiple api calls through promise

update1: - I need to make two different api calls. - from the result of first api call I am getting id in the variable firstAPIid, https://reqres.in/api/users?page=2 - I need to pass this id ...
user avatar
  • 49
3 votes
2 answers
499 views

Idomatic way to ignore `finally` block after cancelling network request

In React, it is quite common for me to have something similar to the following. ...
user avatar
  • 117
3 votes
1 answer
44 views

JavaScript that deletes everything inside a folder on Box.com

I just finished a simple script for Node that will delete all the folders and files inside a specified folder ID through Box's API. It works by getting a list of items inside a folder, then generating ...
user avatar
3 votes
1 answer
278 views

Display and search through a JSON's items in Vue.js

I have put together this small application that displays a "Users" JSON in an HTML5 table. I use Bootstrap 3, Axios and Vue.js 2 for this purpose. Here is the code: ...
user avatar
4 votes
1 answer
56 views

Cancelling ongoing http requests when next one is started - web app search feature

This piece of code is aimed to cancel any ongoing search requests sent from the web application if next request is started, e.g. after user updates the search term. I tested it in the final ...
user avatar
  • 41
4 votes
1 answer
136 views

Fetching data from API in JavaScript

I'm using Axios to fetch data from an API, and don't know if this is the best way to deal with APIs in ReactJS or not. I want to know if anyone can suggest edits or something to make the code more ...
user avatar
3 votes
1 answer
138 views

Mini Tor implementation ("CLI only anonymous network")

The goal of my project is to build a mini "anonymous" network (like Tor is) (command-line only) using Node.js and frameworks (socket.io / axios / express). A ...
user avatar
  • 31