Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

305
Views
VueJS - Axios Interceptors not recieving 401 response

I am trying to have a request and response interceptor setup for Axios when I make Post requests, however I can only get the request interceptor to respond, and nothing else, I've included an example of it not running:

Here is the axios setup:

import axios from "axios";

axios.defaults.baseURL = "https://btk7dl15c9.api.quickmocker.com";

axios.interceptors.request.use(
  async (config) => {
    console.log("request ok");
    return config;
  },
  (error) => {
    console.log("request error");
    return Promise.reject(error);
  }
);
axios.interceptors.response.use(
  (response) => {
    console.log("response ok");
    return response;
  },
  (error) => {
    console.log("response error");
    return Promise.reject(error);
  }
);

export default {
  methods: {
    axiosPost(url, data) {
      return axios.post(url, data);
    }
  }
};

https://codesandbox.io/s/keen-shockley-xccsx

I need to be able to intercept 401 to be able to make a token refresh call (not included with the example)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You used "axios": "0.21.2" which it seems to have a bug in the interceptor that they fixed in v0.21.3

if you up to 0.21.3 or down to 0.21.1 this should fix your issue.

checkout the release log : https://github.com/axios/axios/releases/tag/0.21.3

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!