183. Report upload progress - Part 1 (#26)

This commit is contained in:
Art
2021-09-22 14:46:17 +03:00
parent aeeb66b833
commit db00d8e0bf
3 changed files with 23 additions and 3 deletions

View File

@ -242,15 +242,22 @@ export class UserComponent implements OnInit, OnDestroy {
let subscription = this.userService.updateProfileImage(user.username, formData)
.subscribe(
(event: HttpEvent<any>) => {
this.notificationService.notify(NotificationType.SUCCESS, `Profile image updated successfully: ${event}`);
this.refreshing = false;
this.getUsers(false);
this.reportUploadProgress(event);
},
(errorResponse: HttpErrorResponse) => {
this.sendErrorNotification(errorResponse.error.message);
this.refreshing = false;
},
() => {
this.notificationService.notify(NotificationType.SUCCESS, `Profile image updated successfully: ${event}`);
this.refreshing = false;
this.getUsers(false);
}
);
this.subscriptions.push(subscription);
}
private reportUploadProgress(event: HttpEvent<any>): void {
}
}

View File

@ -0,0 +1,7 @@
import { FileUpload.Status } from './file-upload.status';
describe('FileUpload.Status', () => {
it('should create an instance', () => {
expect(new FileUpload.Status()).toBeTruthy();
});
});

View File

@ -0,0 +1,6 @@
export class FileUploadStatus {
public status: string = '';
public percentage: number = 0;
}