fix: Organize Plaid env variables for development and sandbox envs (#480)

This commit is contained in:
Ahmed Bouhuolia
2024-06-03 20:50:02 +02:00
committed by GitHub
parent 7c06c8bb8a
commit 175bc243f3
10 changed files with 33 additions and 227 deletions

View File

@@ -0,0 +1,25 @@
import { useCallback } from 'react';
import { useSetBankingPlaidToken } from '../state/banking';
import { AppToaster } from '@/components';
import { useGetPlaidLinkToken } from '../query';
import { Intent } from '@blueprintjs/core';
export const useOpenPlaidConnect = () => {
const { mutateAsync: getPlaidLinkToken, isLoading } = useGetPlaidLinkToken();
const setPlaidId = useSetBankingPlaidToken();
const openPlaidAsync = useCallback(() => {
return getPlaidLinkToken()
.then((res) => {
setPlaidId(res.data.link_token);
})
.catch(() => {
AppToaster.show({
message: 'Something went wrong.',
intent: Intent.DANGER,
});
});
}, [getPlaidLinkToken, setPlaidId]);
return { openPlaidAsync, isPlaidLoading: isLoading };
};