Skip to content
Snippets Groups Projects
Commit e66218eb authored by Martin's avatar Martin
Browse files

OZG-5977 upload file by next instead of push

parent bbd2c9d0
No related branches found
No related tags found
1 merge request!67OZG-5977 add multi option to file upload button
......@@ -79,13 +79,20 @@ export class BinaryFileService {
//TODO Rename
public uploadFileNew(toUploadFile: ToUploadFile): void {
this.createEmptyUploadedFilesArrayIfKeyNotExists(toUploadFile.type);
this.uploadFiles.value[toUploadFile.type].push(this._buildUploadFile(toUploadFile));
this.addUploadFile(toUploadFile);
}
private createEmptyUploadedFilesArrayIfKeyNotExists(type: FileUploadType): void {
if (!(type in this.uploadFiles.value)) this.uploadFiles.value[type] = [];
}
private addUploadFile(toUploadFile: ToUploadFile): void {
this.uploadFiles.next({
...this.uploadFiles.value,
[toUploadFile.type]: [...this.uploadFiles.value[toUploadFile.type], this._buildUploadFile(toUploadFile)],
});
}
_buildUploadFile(toUploadFile: ToUploadFile): UploadFile {
return {
key: uniqueId(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment