Skip to content

Commit

Permalink
fix balance not updating after recalim
Browse files Browse the repository at this point in the history
  • Loading branch information
gudnuf committed May 27, 2024
1 parent 1e96cf5 commit a53c849
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/transactionHistory/HistoryTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
isEcashTransaction,
updateTransactionStatus,
} from '@/redux/slices/HistorySlice';
import { setBalance } from '@/redux/slices/Wallet.slice';
import { RootState } from '@/redux/store';
import { addBalance } from '@/utils/cashu';
import { CashuMint, CashuWallet, getDecodedToken } from '@cashu/cashu-ts';
import { CashuMint, CashuWallet, Proof, getDecodedToken } from '@cashu/cashu-ts';
import { BanknotesIcon, BoltIcon } from '@heroicons/react/20/solid';
import { Spinner, Table } from 'flowbite-react';
import { useState } from 'react';
Expand Down Expand Up @@ -89,6 +90,13 @@ const HistoryTableRow: React.FC<{ tx: Transaction }> = ({ tx }) => {
status: TxStatus.PAID,
}),
);

const newBalance = (JSON.parse(localStorage.getItem('proofs') || '[]') as Proof[]).reduce(
(a, b) => a + b.amount,
0,
);

dispatch(setBalance({ usd: newBalance }));
}

setReclaiming(false);
Expand Down

0 comments on commit a53c849

Please sign in to comment.