From 2208a5972d708c40a9e7277b80adcf2603e17b0d Mon Sep 17 00:00:00 2001 From: Devix Rootix Date: Thu, 26 Dec 2024 05:37:10 +0500 Subject: [PATCH] fix: add values to the returned object by submit callback --- packages/forms/src/useform/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/forms/src/useform/index.js b/packages/forms/src/useform/index.js index d78018204f..5c2373423e 100644 --- a/packages/forms/src/useform/index.js +++ b/packages/forms/src/useform/index.js @@ -92,10 +92,20 @@ export const useForm = (options = {}) => { return async (event) => { const results = await validateOn('validateOnSubmit', true); + const { values } = Object.entries(states).reduce( + (acc, [key, val]) => { + acc.values[key] = val.value; + }, + { + values: {} + } + ); + return callback({ originalEvent: event, valid: toValue(valid), states: toValue(states), + values, reset, ...results });