diff --git a/apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts b/apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts index 95281ad212..04dc7caaa8 100644 --- a/apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts +++ b/apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts @@ -21,7 +21,7 @@ import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; import { UploadedFile, UploadFileService } from '@dasch-swiss/vre/shared/app-resource-properties'; import { Store } from '@ngxs/store'; import { ProjectsSelectors } from '@dasch-swiss/vre/shared/app-state'; -import { filter, map, mergeMap } from 'rxjs/operators'; +import { filter, map, mergeMap, take } from 'rxjs/operators'; import { AppConfigService } from '@dasch-swiss/vre/shared/app-config'; // https://stackoverflow.com/questions/45661010/dynamic-nested-reactive-form-expressionchangedafterithasbeencheckederror @@ -99,6 +99,7 @@ export class UploadComponent implements OnInit { this._store.select(ProjectsSelectors.currentProject).pipe( filter(v => v !== undefined), + take(1), map(prj=> prj.shortcode), mergeMap(sc => this._upload.upload(this.file, sc)) ).subscribe( diff --git a/libs/vre/shared/app-resource-properties/src/lib/upload2.component.ts b/libs/vre/shared/app-resource-properties/src/lib/upload2.component.ts index f7f1e9ef59..c0c3928e6a 100644 --- a/libs/vre/shared/app-resource-properties/src/lib/upload2.component.ts +++ b/libs/vre/shared/app-resource-properties/src/lib/upload2.component.ts @@ -8,7 +8,7 @@ import {fileValueMapping} from './file-value-mapping'; import { UploadedFile, UploadFileService } from './upload-file.service'; import {Store} from "@ngxs/store"; import {ProjectsSelectors} from "@dasch-swiss/vre/shared/app-state"; -import {filter, map, mergeMap} from "rxjs/operators"; +import { filter, map, mergeMap, take } from 'rxjs/operators'; @Component({ selector: 'app-upload-2', @@ -123,6 +123,7 @@ export class Upload2Component implements ControlValueAccessor { private _uploadFile(file: File): void { this._store.select(ProjectsSelectors.currentProject).pipe( filter(v => v !== undefined), + take(1), map(prj=> prj.shortcode), mergeMap(sc => this._upload.upload(file, sc)) ).subscribe((res: UploadedFile) => {