mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
17 lines
480 B
JavaScript
17 lines
480 B
JavaScript
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 };
|
|
} |