Skip to content

Commit 043dfa5

Browse files
authored
fix(multifileupload): amend calls to callback functions to use statusText instead of responseText (#1922) (#1932)
Currently the calls to the callback functions use `xhr.responseText` which throws an error due to the `responseType` being 'json'. This error was introduced when migrating from jQuery which always has `responseText` available. Looking at the type definitions and the old jQuery implementation it appears that this argument was intended to be `statusText`.
1 parent 7240964 commit 043dfa5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/moj/components/multi-file-upload/multi-file-upload.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export class MultiFileUpload extends ConfigurableComponent {
225225
this.$status.textContent = xhr.response.success.messageText
226226

227227
$actions.append(this.getDeleteButton(xhr.response.file))
228-
this.config.hooks.exitHook(this, file, xhr, xhr.responseText)
228+
this.config.hooks.exitHook(this, file, xhr, xhr.statusText)
229229
}
230230

231231
const onError = () => {
@@ -238,7 +238,7 @@ export class MultiFileUpload extends ConfigurableComponent {
238238
$message.innerHTML = this.getErrorHtml(error)
239239
this.$status.textContent = error.message
240240

241-
this.config.hooks.errorHook(this, file, xhr, xhr.responseText, error)
241+
this.config.hooks.errorHook(this, file, xhr, xhr.statusText, error)
242242
}
243243

244244
xhr.addEventListener('load', onLoad)
@@ -293,7 +293,7 @@ export class MultiFileUpload extends ConfigurableComponent {
293293
const $rowDelete = $rows.find(($row) => $row.contains($button))
294294
if ($rowDelete) $rowDelete.remove()
295295

296-
this.config.hooks.deleteHook(this, undefined, xhr, xhr.responseText)
296+
this.config.hooks.deleteHook(this, undefined, xhr, xhr.statusText)
297297
})
298298

299299
xhr.open('POST', this.config.deleteUrl)

0 commit comments

Comments
 (0)