@@ -58,6 +58,10 @@ const resolveSubmitOptions = (
58
58
form . setErrors ( { } ) ;
59
59
options . onRequest ?.( context ) ;
60
60
} ,
61
+ async onRequestError ( context ) {
62
+ form . processing = false ;
63
+ options . onRequestError ?.( context ) ;
64
+ } ,
61
65
async onResponse ( context ) {
62
66
form . processing = false ;
63
67
options . onResponse ?.( context ) ;
@@ -115,7 +119,7 @@ export const useSanctumForm = <Data extends Record<string, unknown>>(
115
119
async submit < T = any , R extends ResponseType = 'json' > (
116
120
options : FetchOptions < R > = { } ,
117
121
) : Promise < MappedResponseType < R , T > > {
118
- let methodType = resolveMethod ( method ) ;
122
+ const methodType = resolveMethod ( method ) ;
119
123
let preparedData : Data | FormData = form . data ( ) ;
120
124
121
125
// Convert to FormData if files are detected
@@ -124,12 +128,6 @@ export const useSanctumForm = <Data extends Record<string, unknown>>(
124
128
indices : true ,
125
129
booleansAsIntegers : true ,
126
130
} ) as FormData ;
127
-
128
- // Method spoofing for file uploads with non-POST methods
129
- if ( methodType !== 'post' ) {
130
- preparedData . append ( '_method' , methodType ) ;
131
- methodType = 'post' ;
132
- }
133
131
}
134
132
135
133
return useSanctumFetch ( resolveUrl ( url ) , {
0 commit comments