Feature/filter badge

This commit is contained in:
2024-12-02 07:43:58 +00:00
committed by AmirHossein Mahmoodi
parent 87a637291d
commit dd904e13bc
7 changed files with 52 additions and 15 deletions

View File

@@ -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]);