Keymap data layer (#95)

This commit is contained in:
Nejc Zdovc
2016-09-18 12:38:42 +02:00
committed by József Farkas
parent fb8cd163ec
commit b78bc5850f
40 changed files with 748 additions and 195 deletions

View File

@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects';
import 'rxjs/add/operator/map';
import { KeymapActions } from '../actions/keymap';
@Injectable()
export class KeymapEffects {
@Effect()remove$: any = this.actions$
.ofType(KeymapActions.REMOVE)
.map(() => {
// TODO: Waiting for the fix: https://github.com/angular/angular/issues/10770
// If state is empty router.navigate(['/keymap']);
// Else router.navigate(['/keymap']);
});
@Effect() editAbbr$: any = this.actions$
.ofType(KeymapActions.EDIT_ABBR)
.map<string>(action => action.payload.abbr)
.map((abbr: string) => {
console.log(abbr);
// TODO: Waiting for the fix: https://github.com/angular/angular/issues/10770
// // router.navigate(['/keymap', abbr]);
});
constructor(
private actions$: Actions
) {}
}