How to use UseEffect every time get user and axios?

I use MERN stack and redux. I have two problem and please help me.
1) Every component react I add this:

const user = useSelector( state => state.user );
  useEffect( ()=>{
     dispatch(User_Auth(12)) ; // I write 12 for action work. 

I want to get user data every time if user loginned or not. Is it true? or some idea have?

2) In backend if data current I send using 200 status codes. another variant I send data other status like this:

router.get('/auth', (req, res) => {
        req.user.isAuth = true;
        return res.status(401).json({
            isAuth: false

This is my action get User data:

export const User_Auth =   (value) => async (dispatch) => {
    value = value + 0;
    await axios({
        method: "GET",
    .then(res => {
        dispatch({type: user_auth, payload:});
    }).catch(error => {
        // console.log("Auth geldim: ", error);

I want if cannot see errors in console.log browser. Can I do that? Thanks


If you want to see the status code from an error you have to access it like this


And to get the message


Source: stackoverflow