Hello how can realize 404 error in axios? Here's my code
const WeatherFunc = async (city) => {
const { data } = await axios.get(url, {
params: {
q: city,
units: 'metric',
APPID: apikey,
}
});
return data;
}
Check the response status in the axios promise
axios.get(url, {
//...
}).then(response => {
if (response.status === 404) {
// handle your 404
}
// ...
}).catch(error => {
// handle server error..
})