This repository was archived by the owner on Oct 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-21
lines changed Expand file tree Collapse file tree 2 files changed +4
-21
lines changed Original file line number Diff line number Diff line change 11<script >
2- import { hasFiles , objectToFormData } from " ./FormHelpers.js" ;
2+ import { objectToFormData } from " ./FormHelpers.js" ;
33import { Splade } from " ../Splade.js" ;
44import get from " lodash-es/get" ;
55import has from " lodash-es/has" ;
@@ -43,12 +43,6 @@ export default {
4343 },
4444 },
4545
46- forceFormData: {
47- type: Boolean ,
48- required: false ,
49- default: false ,
50- },
51-
5246 confirm: {
5347 type: [Boolean , String ],
5448 required: false ,
@@ -195,10 +189,9 @@ export default {
195189 this .recentlySuccessful = false ;
196190 clearTimeout (this .recentlySuccessfulTimeoutId );
197191
198- const data =
199- this .forceFormData || hasFiles (this .values )
200- ? objectToFormData (this .values )
201- : this .values ;
192+ const data = (this .values instanceof FormData )
193+ ? this .values
194+ : objectToFormData (this .values );
202195
203196 const headers = { Accept: " application/json" };
204197
Original file line number Diff line number Diff line change 11// The methods in this file are completely stolen from Inertia.js:
22// https://github.com/inertiajs/inertia/tree/master/packages/inertia/src
33
4- export function hasFiles ( data ) {
5- return (
6- data instanceof File ||
7- data instanceof Blob ||
8- ( data instanceof FileList && data . length > 0 ) ||
9- ( data instanceof FormData && Array . from ( data . values ( ) ) . some ( ( value ) => hasFiles ( value ) ) ) ||
10- ( typeof data === "object" && data !== null && Object . values ( data ) . some ( ( value ) => hasFiles ( value ) ) )
11- ) ;
12- }
13-
144export function objectToFormData ( source ) {
155 source = source || { } ;
166
You can’t perform that action at this time.
0 commit comments