Skip to content

Commit

Permalink
feat: update SuccessResolveDisputeDialog to use selectedEscrow funds …
Browse files Browse the repository at this point in the history
…and remove unused state setters
  • Loading branch information
JoelVR17 committed Feb 19, 2025
1 parent cea24bb commit a992e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/components/modules/escrow/ui/dialogs/SuccessDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ interface SuccessResolveDisputeProps {
setIsSuccessResolveDisputeDialogOpen: (value: boolean) => void;
}

// ! EN EL MODAL SOLO ESTA BIEN EL DE TRUSTLESS, EL RESTO NINGUNO
// ! EN LAS TRANSFERENCIAS CREO QUE SE ESTAN PASANDO MAL
export const SuccessResolveDisputeDialog = ({
title,
description,
Expand All @@ -225,10 +227,8 @@ export const SuccessResolveDisputeDialog = ({
});

const selectedEscrow = useGlobalBoundedStore((state) => state.selectedEscrow);
const approverFunds = useGlobalBoundedStore((state) => state.approverFunds);
const serviceProviderFunds = useGlobalBoundedStore(
(state) => state.serviceProviderFunds,
);
const approverFunds = selectedEscrow?.approverFunds || "0";
const serviceProviderFunds = selectedEscrow?.serviceProviderFunds || "0";
const escrow = selectedEscrow || recentEscrow;

const { formatDollar } = useFormatUtils();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { EscrowPayload, ResolveDisputePayload } from "@/@types/escrow.entity";
import { MouseEvent } from "react";
import { getFormSchema } from "../../../schema/resolve-dispute-escrow.schema";
import { toast } from "@/hooks/toast.hook";
//import { useGlobalUIBoundedStore } from "@/core/store/ui";
import { useEscrowBoundedStore } from "../../../store/ui";

interface useResolveDisputeEscrowDialogProps {
Expand All @@ -39,12 +38,6 @@ const useResolveDisputeEscrowDialog = ({
const setRecentEscrow = useGlobalBoundedStore(
(state) => state.setRecentEscrow,
);
const setApproverFunds = useGlobalBoundedStore(
(state) => state.setApproverFunds,
);
const setServiceProviderFunds = useGlobalBoundedStore(
(state) => state.setServiceProviderFunds,
);
const setIsSuccessResolveDisputeDialogOpen = useEscrowBoundedStore(
(state) => state.setIsSuccessResolveDisputeDialogOpen,
);
Expand Down Expand Up @@ -76,6 +69,8 @@ const useResolveDisputeEscrowDialog = ({
...selectedEscrow,
resolvedFlag: true,
disputeFlag: false,
approverFunds: payload.approverFunds,
serviceProviderFunds: payload.serviceProviderFunds,
};

const responseFlag = await updateEscrow({
Expand All @@ -89,8 +84,6 @@ const useResolveDisputeEscrowDialog = ({
setIsResolvingDispute(false);
setIsDialogOpen(false);
fetchAllEscrows({ address, type: activeTab || "client" });
setApproverFunds(payload.approverFunds);
setServiceProviderFunds(payload.serviceProviderFunds);
setIsSuccessResolveDisputeDialogOpen(true);

if (selectedEscrow) {
Expand Down

0 comments on commit a992e64

Please sign in to comment.