fix: refetch wallet data on mount

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2024-10-30 20:57:54 +08:00
parent 71fcf50d0f
commit 2d11eb2d92
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 5 additions and 1 deletions

View File

@ -100,6 +100,7 @@ export const MyWalletSection = ({ className }: { className?: string }) => {
{BigInt(myWallet.powerToken || 0n)}
</Balance>
<Button
buttonClassName={tw`rounded-full`}
variant="ghost"
onClick={() => refreshMutation.mutate()}
disabled={refreshMutation.isPending}

View File

@ -58,7 +58,10 @@ export const wallet = {
},
}
export const useWallet = () => useAuthQuery(wallet.get())
export const useWallet = () =>
useAuthQuery(wallet.get(), {
refetchOnMount: true,
})
export const useWalletTransactions = (query: Parameters<typeof wallet.transactions.get>[0] = {}) =>
useAuthQuery(wallet.transactions.get(query))