Feature/filter badge
This commit is contained in:
@@ -27,7 +27,7 @@ const authReducer = (state, action) => {
|
||||
const AuthContext = createContext();
|
||||
|
||||
export const AuthProvider = ({ children }) => {
|
||||
const [errorState, setErrorState] = useState(null);
|
||||
const [errorState, setErrorState] = useState({ status: null, message: "" });
|
||||
const [state, dispatch] = useReducer(authReducer, initAuth);
|
||||
|
||||
const clearUser = useCallback(() => {
|
||||
@@ -66,7 +66,8 @@ export const AuthProvider = ({ children }) => {
|
||||
changeInitAuth(true);
|
||||
return;
|
||||
}
|
||||
setErrorState(true);
|
||||
let status = error.response && error.response.status ? error.response.status : "نامشخص";
|
||||
setErrorState({ status, message: " مشکلی در احراز هویت رخ داده است . دقایقی بعد امتحان کنید!!!" });
|
||||
}
|
||||
}, [clearUser, changeUser, changeAuthState, changeInitAuth]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user