Если бэкэнд-приложение API не работает или не запущено, в консоли браузера появится следующая ошибка.
OPTIONS http://127.0.0.1:3000/api/user_token net::ERR_CONNECTION_REFUSED
Как справиться с этой ошибкой?
axios.get(url, oprtions) .then((response) => console.log(response)) .catch((error) => console.log(error)); // error.response, error.response.status, and so on
или
fetch(url, oprtions) .then((response) => console.log(response)) .catch((error) => console.log(error)); // error.response, error.response.status, and so on
Подробнее об обработке ошибок: