Fix upload is permitted without a file being selected

master
trivernis 5 years ago
parent 5a19cc0dc4
commit c0ce20f65d

@ -39,6 +39,7 @@ export class DialogFileUploadComponent {
* Fired when the ok button was pressed * Fired when the ok button was pressed
*/ */
onOkClicked() { onOkClicked() {
if (this.file) {
this.errorOccurred = false; this.errorOccurred = false;
this.uploading = true; this.uploading = true;
this.selfService.changeProfilePicture(this.file).subscribe((response) => { this.selfService.changeProfilePicture(this.file).subscribe((response) => {
@ -60,6 +61,10 @@ export class DialogFileUploadComponent {
this.errorMessage = 'Failed to upload the profile picture.'; this.errorMessage = 'Failed to upload the profile picture.';
} }
}); });
} else {
this.errorOccurred = true;
this.errorMessage = 'Please select a file to upload.';
}
} }
/** /**

Loading…
Cancel
Save