When I do something like this in my code,
export function initUserFromStorage() {
const request = axios.get("users/validate");
return (dispatch) => {
request.then(
({data}) => {
let user = JSON.parse(localStorage.getItem("user"));
dispatch({ type: TOKEN_VALID, payload: user });
},
(error) => {
localStorage.removeItem("user");
dispatch({ type: TOKEN_INVALID, payload: null });
}
)
}
}
I get a "GET http://127.0.0.1:3000/api/users/validate 401 (Unauthorized)" displayed in my debug console. Is there anyway to hide that message? I'm catching the error so I thought nothing would be displayed.
Are you using Chrome? If yes, Chrome logs all network issues (including 4XX and 5XX errors) by default regardless of whether they are handled in the code or not. You can disable this behavior by checking "Hide network messages" checkbox in the Chrome DevTools settings (please see this for details).
Hope this helps!
Most helpful comment
Are you using Chrome? If yes, Chrome logs all network issues (including 4XX and 5XX errors) by default regardless of whether they are handled in the code or not. You can disable this behavior by checking "Hide network messages" checkbox in the Chrome DevTools settings (please see this for details).
Hope this helps!