I am using axios to post form data to Laravel.
Currently I am able to access the response if successful, however I'm having trouble accessing the error response. In dev tools, I can see my network > response has the following:
{"success":false,"data":{"message":"Token mismatch","refresh":true}}
I'm trying to access refresh to do a boolean comparison, so if its true the page will reload. How do I access this?
I've tried the following:
console.log(error.response);
console.log(error.response.data);
console.log(error.response.data.message);
console.log(error.data);
console.log(error);
Which log as the following respectively:
[object Object]
[object Object]
undefined
undefined
Error: Request failed with status code 419