diff --git a/components/form/field/TypeUploadSingle.tsx b/components/form/field/TypeUploadSingle.tsx index 532ad37..bccf6cb 100644 --- a/components/form/field/TypeUploadSingle.tsx +++ b/components/form/field/TypeUploadSingle.tsx @@ -85,7 +85,7 @@ export const FieldUploadSingle: FC<{ input.isLocal = true; input.render(); if (typeof on_change === "function") { - on_change({}); + await on_change({}); } return; const formData = new FormData(); diff --git a/utils/action.tsx b/utils/action.tsx index aa6ade0..04ebcf0 100644 --- a/utils/action.tsx +++ b/utils/action.tsx @@ -7,12 +7,21 @@ export const actionToast = async (data: { before?: () => any; success?: () => any; after?: () => any; + failed?: () => any; msg_succes?: string; msg_error?: string; msg_load?: string; }) => { - const { task, before, after, success, msg_succes, msg_error, msg_load } = - data; + const { + task, + before, + after, + success, + msg_succes, + msg_error, + msg_load, + failed, + } = data; try { if (typeof before === "function") before(); @@ -61,6 +70,7 @@ export const actionToast = async (data: { }, 100); } catch (ex: any) { setTimeout(() => { + if (typeof failed === "function") failed(); toast.dismiss(); toast.error(