<Button
size="large"
icon={<CheckSquareOutlined />}
onClick={() => {
confirmDialog({
message: t("confirmDialog.edit.message"),
header: t("confirmDialog.edit.header"),
icon: "pi pi-exclamation-triangle",
acceptLabel: t("confirmDialog.edit.acceptLabel"),
rejectLabel: t("confirmDialog.edit.rejectLabel"),
acceptClassName: "p-button-warning",
accept: async () => { // Make this function async
const convertedPayload: IConvertedPayload[] = convertToPayload(productDetails);
await mutate( // Wait for the mutate function to complete
{
resource: "product-details",
values: convertedPayload,
},
{
onSuccess: () => {
list("products");
},
}
);
},
reject: () => {},
});
}}
>
Submit
</Button>
<Button
size="large"
icon={<CheckSquareOutlined />}
onClick={() => {
confirmDialog({
message: t("confirmDialog.edit.message"),
header: t("confirmDialog.edit.header"),
icon: "pi pi-exclamation-triangle",
acceptLabel: t("confirmDialog.edit.acceptLabel"),
rejectLabel: t("confirmDialog.edit.rejectLabel"),
acceptClassName: "p-button-warning",
accept: async () => { // Make this function async
const convertedPayload: IConvertedPayload[] = convertToPayload(productDetails);
await mutate( // Wait for the mutate function to complete
{
resource: "product-details",
values: convertedPayload,
},
{
onSuccess: () => {
list("products");
},
}
);
},
reject: () => {},
});
}}
>
Submit
</Button>