diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/bank.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/hooks/bank.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/bank.ts b/packages/merchant-backoffice-ui/src/hooks/bank.ts index 03b064646..5d5785442 100644 --- a/packages/merchant-backoffice-ui/src/hooks/bank.ts +++ b/packages/merchant-backoffice-ui/src/hooks/bank.ts @@ -25,7 +25,7 @@ import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js"; import { useBackendInstanceRequest, useMatchMutate } from "./backend.js"; // FIX default import https://github.com/microsoft/TypeScript/issues/49189 -import _useSWR, { SWRHook } from "swr"; +import _useSWR, { SWRHook, mutate } from "swr"; const useSWR = _useSWR as unknown as SWRHook; // const MOCKED_ACCOUNTS: Record<string, MerchantBackend.BankAccounts.AccountAddDetails> = { @@ -106,6 +106,10 @@ export interface BankAccountAPI { export interface InstanceBankAccountFilter { } +export function revalidateInstanceBankAccounts() { + // mutate(key => key instanceof) + return mutate((key) => Array.isArray(key) && key[key.length - 1] === "/private/accounts", undefined, { revalidate: true }); +} export function useInstanceBankAccounts( args?: InstanceBankAccountFilter, updatePosition?: (id: string) => void, @@ -113,17 +117,7 @@ export function useInstanceBankAccounts( MerchantBackend.BankAccounts.AccountsSummaryResponse, MerchantBackend.ErrorDetail > { - // return { - // ok: true, - // loadMore() { }, - // loadMorePrev() { }, - // data: { - // accounts: Object.values(MOCKED_ACCOUNTS).map(e => ({ - // ...e, - // active: true, - // })) - // } - // } + const { fetcher } = useBackendInstanceRequest(); const [pageAfter, setPageAfter] = useState(1); |