mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
Fix: Utilize user-defined onSuccess, onError, and onProgress callbacks in @uppy/tus (#4674)
* @uppy/tus onSuccess, onError, and onProgress * @uppy/tus Fix ESLint issues * @uppy/tus Fix ESLint issues * @uppy/tus Fix ESLint issues
This commit is contained in:
parent
0acb99e371
commit
e400d4ccbe
1 changed files with 9 additions and 1 deletions
|
|
@ -250,12 +250,17 @@ export default class Tus extends BasePlugin {
|
|||
queuedRequest?.abort()
|
||||
|
||||
this.uppy.emit('upload-error', file, err)
|
||||
|
||||
if (typeof opts.onError === 'function') {
|
||||
opts.onError(err)
|
||||
}
|
||||
reject(err)
|
||||
}
|
||||
|
||||
uploadOptions.onProgress = (bytesUploaded, bytesTotal) => {
|
||||
this.onReceiveUploadUrl(file, upload.url)
|
||||
if (typeof opts.onProgress === 'function') {
|
||||
opts.onProgress(bytesUploaded, bytesTotal)
|
||||
}
|
||||
this.uppy.emit('upload-progress', file, {
|
||||
uploader: this,
|
||||
bytesUploaded,
|
||||
|
|
@ -276,6 +281,9 @@ export default class Tus extends BasePlugin {
|
|||
if (upload.url) {
|
||||
this.uppy.log(`Download ${upload.file.name} from ${upload.url}`)
|
||||
}
|
||||
if (typeof opts.onSuccess === 'function') {
|
||||
opts.onSuccess()
|
||||
}
|
||||
|
||||
resolve(upload)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue