AW-432 converted event to action
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2019-08-16 09:40:00 +02:00
parent c5d7550750
commit 4671ce08d3
2 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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<string> = new EventEmitter();
constructor(private cd: ChangeDetectorRef, public uploadService: ResumableFileUploadService) {
constructor(private cd: ChangeDetectorRef, public uploadService: ResumableFileUploadService,public store: Store<commonReducer.State>) {
}
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