mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
refactoring: authentication with react-query.
This commit is contained in:
17
client/src/hooks/state/globalErrors.js
Normal file
17
client/src/hooks/state/globalErrors.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { setGlobalErrors } from 'store/globalErrors/globalErrors.actions';
|
||||
|
||||
export const useSetGlobalErrors = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
return useCallback((errors) => {
|
||||
dispatch(setGlobalErrors(errors));
|
||||
}, [dispatch]);
|
||||
};
|
||||
|
||||
export const useGlobalErrors = () => {
|
||||
const globalErrors = useSelector(state => state.globalErrors.data);
|
||||
|
||||
return { globalErrors };
|
||||
}
|
||||
Reference in New Issue
Block a user