diff --git a/resources/views/upload.blade.php b/resources/views/upload.blade.php index 8b72fc3..724ba13 100644 --- a/resources/views/upload.blade.php +++ b/resources/views/upload.blade.php @@ -57,16 +57,22 @@ class="{{ $attributes->get('class') }}" pond.setOptions({ allowMultiple: isMultiple, server: { - process: (fieldName, file, metadata, load, error, progress) => { - @this.upload('{{ $wireModelAttribute }}', file, load, error, progress); + process: async (fieldName, file, metadata, load, error, progress) => { + $dispatch('filepond-upload-started', '{{ $wireModelAttribute }}'); + await @this.upload('{{ $wireModelAttribute }}', file, (response) => { + load(response); + $dispatch('filepond-upload-finished', {'{{ $wireModelAttribute }}': response }); + }, error, progress); }, - revert: (filename, load) => { - @this.revert('{{ $wireModelAttribute }}', filename, load); + revert: async (filename, load) => { + await @this.revert('{{ $wireModelAttribute }}', filename, load); + $dispatch('filepond-upload-reverted', '{{ $wireModelAttribute }}'); }, - remove: (file, load) => { - console.log(file); - @this.remove('{{ $wireModelAttribute }}', file.name); + remove: async (file, load) => { + console.log(file); + await @this.remove('{{ $wireModelAttribute }}', file.name); load(); + $dispatch('filepond-upload-file-removed', '{{ $wireModelAttribute }}'); }, }, labelIdle: @js($placeholder),