Skip to content

Commit

Permalink
- app version = 5.11.24 (#739)
Browse files Browse the repository at this point in the history
- simplified logic
- fixed bug where cancelling a file selection incorrectly deletes first doc

Co-authored-by: Severin Beauvais <[email protected]>
  • Loading branch information
severinbeauvais and Severin Beauvais authored Sep 27, 2024
1 parent ae7df17 commit acb4358
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "5.11.23",
"version": "5.11.24",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
19 changes: 8 additions & 11 deletions src/components/ContinuationIn/ContinuationAuthorization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,13 @@ export default class ExtraproRegistration extends Mixins(DocumentMixin) {
* @param index the index of the file to delete
*/
async onFileSelected (file: File, index = 0): Promise<void> {
if (file) {
// verify that file is valid
if (!this.fileValidity) {
// NB: as this is validity according to the component, do not overwrite current error message
return // don't add to array and don't change existing file
}
// verify that file is valid
if (this.fileValidity && file) {
// verify that file doesn't already exist
if (this.authorization.files.find(f => f.file.name === file.name)) {
// put file uploader into manual error mode by setting custom error message
this.customErrorMessage = 'Duplicate file'
return // don't add to list
return // don't add to array
}
// try to upload to Minio
Expand All @@ -370,9 +365,11 @@ export default class ExtraproRegistration extends Mixins(DocumentMixin) {
})
this.isFileAdded = true
} else {
// delete file from Minio; ignore errors
await this.deleteDocument(this.authorization.files[index].fileKey).catch(() => null)
} else if (file === null) {
// null file means user clicked Remove button - proceed
// undefined file means file upload was cancelled - do nothing
// delete file from Minio, not waiting for response and ignoring errors
this.deleteDocument(this.authorization.files[index].fileKey).catch(() => null)
// remove file from array
this.authorization.files.splice(index, 1)
}
Expand Down

0 comments on commit acb4358

Please sign in to comment.