From e84389248d1e47924965e920b48b7db4be9cb7fe Mon Sep 17 00:00:00 2001 From: Lucien Le Roux Date: Wed, 26 Aug 2026 15:30:49 +0200 Subject: [PATCH] feat: added get bank account by id --- pages/containers/Authenticated.tsx | 8 ++++++ pages/features/GetBankAccountById.tsx | 37 +++++++++++++++++++++++++++ server/main.ts | 2 ++ server/routes/bankAccountById.ts | 22 ++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 pages/features/GetBankAccountById.tsx create mode 100644 server/routes/bankAccountById.ts diff --git a/pages/containers/Authenticated.tsx b/pages/containers/Authenticated.tsx index bfeb687..ea9dbd3 100644 --- a/pages/containers/Authenticated.tsx +++ b/pages/containers/Authenticated.tsx @@ -8,6 +8,7 @@ import SignIn from './SignIn'; import { AuthenticatedData } from '../utils'; import GetCompanyProfile from '../features/GetCompanyProfile'; import GetBankAccounts from '../features/GetBankAccounts'; +import GetBankAccountById from '../features/GetBankAccountById'; import GetTransactions from '../features/GetTransactions'; import GetTransactionById from '../features/GetTransactionById'; import GetReceiptForTransaction from '../features/GetReceiptForTransaction'; @@ -97,6 +98,13 @@ function Authenticated({ authenticatedData }: { authenticatedData: Authenticated authenticatedData={authenticatedData} /> + + + Transactions diff --git a/pages/features/GetBankAccountById.tsx b/pages/features/GetBankAccountById.tsx new file mode 100644 index 0000000..8640255 --- /dev/null +++ b/pages/features/GetBankAccountById.tsx @@ -0,0 +1,37 @@ +import React, { useCallback, useState } from 'react'; +import Button from '../components/Button'; +import axios, { AxiosError } from 'axios'; +import { FeatureParams, SContainer, SInput, stringifyResponse } from '../utils'; + +function GetBankAccountById({ authenticatedData, setOperationOutput, setError }: FeatureParams) { + const [bankAccountId, setBankAccountId] = useState(''); + + const getBankAccountById = useCallback(() => { + setError(null); + axios + .get('/bank-account-by-id', { + params: { + bankAccountId, + access_token: authenticatedData.access_token, // in real world scenario, this should be stored in a your backend + }, + }) + .then((result) => setOperationOutput(stringifyResponse(result.data))) + .catch((err: AxiosError) => setError(stringifyResponse(err.response.data))); + }, [setError, setOperationOutput, authenticatedData, bankAccountId]); + + return ( + + setBankAccountId(e.target.value)} + type="text" + placeholder="Bank account id" + size={40} + /> + +