mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
16 lines
561 B
JavaScript
16 lines
561 B
JavaScript
import { useCallback } from "react";
|
|
import { useSelector, useDispatch } from "react-redux";
|
|
import { setOrganizations } from 'store/organizations/organizations.actions';
|
|
import { getCurrentOrganizationFactory } from 'store/authentication/authentication.selectors';
|
|
|
|
export const useSetOrganizations = () => {
|
|
const dispatch = useDispatch();
|
|
|
|
return useCallback((organizations) => {
|
|
dispatch(setOrganizations(organizations))
|
|
}, [dispatch]);
|
|
};
|
|
|
|
export const useCurrentOrganization = () => {
|
|
return useSelector(getCurrentOrganizationFactory())
|
|
}; |