Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
590 B
2
Indexable
Never
      http
        .get(`/users/exists`, {
          headers: { Authorization: userLocalStorage.token },
        })
        .then(({ data }) => {
          setAuth(data.user);
        })
        .catch((err) => {
          if (
            err.response.data.message === 'Your account is Suspend!' ||
            err.response.data.message === 'User Authentication Needed.'
          ) {
            localStorage.removeItem('userAuth');
            localStorage.removeItem('questionPackAnswredNumber');
            window.location.reload(false);
          }
        });
    }