0

So I'm sending a request, and it is sent sucessfuly, but in axios I'm not getting the interceptor back and I don't get why, instead of that I got an error: Cannot read property 'status' of undefined.

Here is my code for interceptor:

listService.interceptors.response.use(
    
    (response) => {
        console.log('Interceptor', response);
        return response;
    },
    (error) => {
        if(error.response.status == 401){
            console.log("Status of undefined!")
        }
    }
);

Here is what I get in console: enter image description here

Jan Tuđan
  • 233
  • 3
  • 17
  • Can you please use console.log(error) inside the error handler and share the result? – Amir MB Aug 17 '21 at 14:19
  • Might this answer your question: https://stackoverflow.com/questions/49886315/axios-interceptors-response-undefined – Ryan Le Aug 17 '21 at 14:26
  • @AmirMB okay I realised that problem is with client.isConnected with my mongo database, it's working and it's not working on the same time while posting, it's on the new mongo update, idk what to do. – Jan Tuđan Aug 17 '21 at 17:59
  • I updated the question, what I get in my console after the posting at the first time, in the second time it doesn't work, I have to save my working file. I'm working in vue.js – Jan Tuđan Aug 17 '21 at 18:02

0 Answers0