diff --git a/projects/common/src/lib/actions/app-common.actions.ts b/projects/common/src/lib/actions/app-common.actions.ts index 0f5a3b3..852d65e 100644 --- a/projects/common/src/lib/actions/app-common.actions.ts +++ b/projects/common/src/lib/actions/app-common.actions.ts @@ -41,6 +41,8 @@ export const VIEWITEM = "[AppCommon] ViewItem"; export const FAIL = '[AppCommon] Fail'; +export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick'; + export class InitUser implements Action { readonly type = INITUSER; @@ -191,6 +193,12 @@ export class ShowNavBar implements Action { constructor() { } } +export class UploadedFileClick implements Action { + readonly type = UPLOADEDFILECLICK; + constructor(public itemCode:string) { } +} + + export type Actions = OpenModal | InitRoot | InitRootSuccess diff --git a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.ts b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.ts index 4ff7d97..bedd060 100644 --- a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.ts +++ b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.ts @@ -1,6 +1,9 @@ import { Component, Input,Output, HostListener, ChangeDetectorRef, OnDestroy, OnInit,EventEmitter } from '@angular/core'; import { ResumableFileUploadService, File } from './resumable-file-upload.service'; import { Subscription } from 'rxjs'; +import { Store } from '@ngrx/store'; +import * as commonReducer from '../../reducers/app-common.reducer'; +import * as commonActions from '../../actions/app-common.actions'; @Component({ @@ -18,9 +21,8 @@ export class ResumableFileUploadComponent implements OnInit, OnDestroy { else this.uploadService.parentCode = null; } - @Output() onUploadedFileClick:EventEmitter = new EventEmitter(); - constructor(private cd: ChangeDetectorRef, public uploadService: ResumableFileUploadService) { + constructor(private cd: ChangeDetectorRef, public uploadService: ResumableFileUploadService,public store: Store) { } private refreshSub: Subscription; @@ -38,7 +40,7 @@ export class ResumableFileUploadComponent implements OnInit, OnDestroy { handleUploadedFileClick(event:MouseEvent,file:File) { event.preventDefault(); - this.onUploadedFileClick.emit(file.identifier); + this.store.dispatch(new commonActions.UploadedFileClick(file.identifier)); } //TODO do this with an canunload guard