mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
33 lines
678 B
TypeScript
33 lines
678 B
TypeScript
import {
|
|
getPlaidToken,
|
|
setPlaidId,
|
|
resetPlaidId,
|
|
} from '@/store/banking/banking.reducer';
|
|
import { useCallback } from 'react';
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
export const useSetBankingPlaidToken = () => {
|
|
const dispatch = useDispatch();
|
|
|
|
return useCallback(
|
|
(plaidId: string) => {
|
|
dispatch(setPlaidId(plaidId));
|
|
},
|
|
[dispatch],
|
|
);
|
|
};
|
|
|
|
export const useGetBankingPlaidToken = () => {
|
|
const plaidToken = useSelector(getPlaidToken);
|
|
|
|
return plaidToken;
|
|
};
|
|
|
|
export const useResetBankingPlaidToken = () => {
|
|
const dispatch = useDispatch();
|
|
|
|
return useCallback(() => {
|
|
dispatch(resetPlaidId());
|
|
}, [dispatch]);
|
|
};
|