1👍
✅
Your baclend is not serializing object correctly. So message is a part of a string instead of JSON property. If you don’t want to change that you can use
const message = error.response.data.error.substring(
str.indexOf('"') + 1,
str.lastIndexOf('"')
);
Source:stackexchange.com