Browse Source

Fix: Return response from submit handler

DenLopes 1 tháng trước cách đây
mục cha
commit
da8aec40e7
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/composables/useSubmitHandler.js

+ 5 - 1
src/composables/useSubmitHandler.js

@@ -60,7 +60,11 @@ export function useSubmitHandler(options = {}) {
 
     try {
       const response = await apiCallThunk();
-      if (typeof onSuccess === "function") await onSuccess(response);
+      if (typeof onSuccess === "function") {
+        await onSuccess(response);
+      } else {
+        return response;
+      }
     } catch (error) {
       await handleError(error);
     } finally {