Questions tagged axios

Explore the latest questions and answers asked by our top developers.

Typing Axios interceptor (axios.create) response typescript definitions

I am currently working on a react typescript app and I’m trying to properly type my axios interceptor. I can’t seem to figure out exactly how to crack the types. TL;DR The Problem: TS not recognizing my axios interceptor response configuration types properly. My Code –Interceptor creation const client = axios.create({ baseURL: apiURL }); export […]

By DOZBORNE
Published
Categorized as angular, axios, javascript, reactjs, typescript Tagged , , , ,

Multiple requests are returning errors

I’m using axios to intercept requests and responses from an API. To make my work easier, I’m testing the following library axios-auth-refresh. This library checks for a 401 error and refreshes the token and updates all order states. My problem is that when I make multiple requests the API always returns the 401 and the […]

Multiple requests are returning errors – axios auth refresh

I’m using axios to intercept requests and responses from an API. To make my work easier, I’m testing the following library axios-auth-refresh. This library checks for a 401 error and refreshes the token and updates all order states. My problem is that when I make multiple requests the API always returns the 401 and the […]

Intercept 401 error and prevent console error message

I’m using the following library axios-auth-refresh to automatically refresh the token. When I make a call to the API it returns a 401 error and in this way the library is triggered in order to execute the refresh token and ensure that all requests are successfully completed. I’m using axios to make API calls and […]

By Harry
Published
Categorized as angular, axios, javascript, jwt, typescript Tagged , , , ,

Axios Interceptor – Synchronous multi-request mechanism for the Refresh Token

Is there a way to make the axios.interceptors.request.use function synchronize so that each request is executed in an orderly way, that is, the second only executes at the end of the first? The objective is to intercept the requests and check if the token is valid or not. If the token is not valid or […]

By Harry
Published
Categorized as access-token, angular, axios, jwt, typescript Tagged , , , ,

Interceptor – multi-request mechanism for the Refresh Token

Is there a way to make the axios.interceptors.request.use function synchronize so that each request is executed in an orderly way, that is, the second only executes at the end of the first? The objective is to intercept the requests and check if the token is valid or not. If the token is not valid or […]

By Harry
Published
Categorized as access-token, angular, axios, jwt, typescript Tagged , , , ,

symfony 5 and angular app CORS issue on preflight requests

I have opened wide the CORS config in my symfony 5 app with nelmio cors bundle, but i dont understand why my POST and OPTIONS preflight calls from Angular / Axios gets rejected by the CORS config. When everything of the front is bundled and deployed on the same domain it works fine, but on […]

By Ty Kayn
Published
Categorized as angular, axios, cors, symfony, xmlhttprequest Tagged , , , ,

How to intercept HTTP Calls in AWS Amplify with Angular

Problem Statement: I have working on project in Angular using AWS Amplify. The project uses cognito and successfully created AWS api for client calls. Now, I need an interceptor to intercept the requests as I need to do perform some action. What I DID: I have tried using Angular HTTP Interceptors but they don’t work. […]

Angular http post request fails, but axios one works

I’m doing a POST request with Angular 9 HttpClient but it fails with ‘Provisional headers are shown’ My code is like: const header = { headers: new HttpHeaders({ ‘Access-Control-Allow-Origin’: ‘*’, ‘Content-Type’: ‘application/x-www-form-urlencoded’, }) }; const req = new HttpRequest(‘POST’, url, bytes, { headers: header.headers, reportProgress: true, }); return this.http.request(req).pipe( map((event) => { if (multyStepsUpload) { […]

By Kaloyan Stamatov
Published
Categorized as angular, axios, http, httpclient, javascript Tagged , , , ,

Why i am not able to read service side response in axios?

I have my react application where in i am using axios. While doing error handling in catch block , i am not able to receive response sent by service side. Below is my client catch block : .catch((error) => { console.log(‘Error’, error.response); dispatch({ type: ERROR, payload: error, }); }); In the error object , I […]

By Avinash
Published
Categorized as angular, axios, ecmascript-6, javascript, reactjs Tagged , , , ,
1 2 3

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq