Skip to content

Commit

Permalink
fix(app/worker/profile): refetch KVStore data after setting address (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperKoza343 authored Jun 26, 2024
1 parent 804d8cc commit c0bf8fe
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ import { t } from 'i18next';
import { Button } from '@/components/ui/button';
import { useRegisterAddress } from '@/api/servieces/worker/use-register-address';
import { useRegisterAddressNotifications } from '@/hooks/use-register-address-notifications';
import { useGetOnChainRegisteredAddress } from '@/api/servieces/worker/get-on-chain-registered-address';

export function RegisterAddress({ disabled }: { disabled: boolean }) {
const { onSuccess, onError } = useRegisterAddressNotifications();
const {
refetch: refetchKVStoreAddressData,
isPending: isKVStoreAddressDataPending,
} = useGetOnChainRegisteredAddress();
const { mutate, isPending } = useRegisterAddress({
onError,
onSuccess,
onSuccess: () => {
void refetchKVStoreAddressData();
onSuccess();
},
});

return (
<Button
disabled={disabled}
fullWidth
loading={isPending}
loading={isPending || isKVStoreAddressDataPending}
onClick={mutate.bind(undefined, undefined)}
variant="contained"
>
Expand Down

0 comments on commit c0bf8fe

Please sign in to comment.