diff options
Diffstat (limited to 'packages/bank-ui/src/hooks/account.ts')
-rw-r--r-- | packages/bank-ui/src/hooks/account.ts | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/packages/bank-ui/src/hooks/account.ts b/packages/bank-ui/src/hooks/account.ts index aa0745253..5fe12573c 100644 --- a/packages/bank-ui/src/hooks/account.ts +++ b/packages/bank-ui/src/hooks/account.ts @@ -62,7 +62,11 @@ export function useAccountDetails(account: string) { } export function revalidateWithdrawalDetails() { - return mutate((key) => Array.isArray(key) && key[key.length - 1] === "getWithdrawalById", undefined, { revalidate: true }); + return mutate( + (key) => Array.isArray(key) && key[key.length - 1] === "getWithdrawalById", + undefined, + { revalidate: true }, + ); } export function useWithdrawalDetails(wid: string) { @@ -110,7 +114,9 @@ export function useWithdrawalDetails(wid: string) { export function revalidateTransactionDetails() { return mutate( - (key) => Array.isArray(key) && key[key.length - 1] === "getTransactionById", undefined, { revalidate: true } + (key) => Array.isArray(key) && key[key.length - 1] === "getTransactionById", + undefined, + { revalidate: true }, ); } export function useTransactionDetails(account: string, tid: number) { @@ -149,7 +155,9 @@ export function useTransactionDetails(account: string, tid: number) { export async function revalidatePublicAccounts() { return mutate( - (key) => Array.isArray(key) && key[key.length - 1] === "getPublicAccounts", undefined, { revalidate: true } + (key) => Array.isArray(key) && key[key.length - 1] === "getPublicAccounts", + undefined, + { revalidate: true }, ); } export function usePublicAccounts( @@ -193,9 +201,10 @@ export function usePublicAccounts( data && data.type === "ok" && data.body.public_accounts.length <= PAGE_SIZE; const isFirstPage = !offset; - const result = data && data.type == "ok" ? structuredClone(data.body.public_accounts) : [] - if (result.length == PAGE_SIZE+1) { - result.pop() + const result = + data && data.type == "ok" ? structuredClone(data.body.public_accounts) : []; + if (result.length == PAGE_SIZE + 1) { + result.pop(); } const pagination = { result, @@ -243,7 +252,7 @@ export function useTransactions(account: string, initial?: number) { return await api.getTransactions( { username, token }, { - limit: PAGE_SIZE +1 , + limit: PAGE_SIZE + 1, offset: txid ? String(txid) : undefined, order: "dec", }, @@ -267,9 +276,10 @@ export function useTransactions(account: string, initial?: number) { data && data.type === "ok" && data.body.transactions.length <= PAGE_SIZE; const isFirstPage = !offset; - const result = data && data.type == "ok" ? structuredClone(data.body.transactions) : [] - if (result.length == PAGE_SIZE+1) { - result.pop() + const result = + data && data.type == "ok" ? structuredClone(data.body.transactions) : []; + if (result.length == PAGE_SIZE + 1) { + result.pop(); } const pagination = { result, |