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 FAIL = '[AppCommon] Fail';
export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick';
export class InitUser implements Action { export class InitUser implements Action {
readonly type = INITUSER; readonly type = INITUSER;
@ -191,6 +193,12 @@ export class ShowNavBar implements Action {
constructor() { } constructor() { }
} }
export class UploadedFileClick implements Action {
readonly type = UPLOADEDFILECLICK;
constructor(public itemCode:string) { }
}
export type Actions = OpenModal export type Actions = OpenModal
| InitRoot | InitRoot
| InitRootSuccess | InitRootSuccess

View File

@ -1,6 +1,9 @@
import { Component, Input,Output, HostListener, ChangeDetectorRef, OnDestroy, OnInit,EventEmitter } from '@angular/core'; import { Component, Input,Output, HostListener, ChangeDetectorRef, OnDestroy, OnInit,EventEmitter } from '@angular/core';
import { ResumableFileUploadService, File } from './resumable-file-upload.service'; import { ResumableFileUploadService, File } from './resumable-file-upload.service';
import { Subscription } from 'rxjs'; 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({ @Component({
@ -18,9 +21,8 @@ export class ResumableFileUploadComponent implements OnInit, OnDestroy {
else else
this.uploadService.parentCode = null; 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; private refreshSub: Subscription;
@ -38,7 +40,7 @@ export class ResumableFileUploadComponent implements OnInit, OnDestroy {
handleUploadedFileClick(event:MouseEvent,file:File) { handleUploadedFileClick(event:MouseEvent,file:File) {
event.preventDefault(); event.preventDefault();
this.onUploadedFileClick.emit(file.identifier); this.store.dispatch(new commonActions.UploadedFileClick(file.identifier));
} }
//TODO do this with an canunload guard //TODO do this with an canunload guard