Remove newAbbr from KeymapState

This commit is contained in:
Farkas József
2017-02-07 21:42:47 +01:00
parent 9dcdd6b3b2
commit e41a62be13
3 changed files with 7 additions and 10 deletions
+6 -7
View File
@@ -16,7 +16,7 @@ import { Keymap } from '../../config-serializer/config-items/Keymap';
@Injectable() @Injectable()
export class KeymapEffects { export class KeymapEffects {
@Effect({ dispatch: false })add$: any = this.actions$ @Effect({ dispatch: false }) add$: any = this.actions$
.ofType(KeymapActions.ADD) .ofType(KeymapActions.ADD)
.withLatestFrom(this.store) .withLatestFrom(this.store)
.do((latest) => { .do((latest) => {
@@ -34,7 +34,7 @@ export class KeymapEffects {
this.router.navigate(['/keymap', entities[entities.length - 1].abbreviation]); this.router.navigate(['/keymap', entities[entities.length - 1].abbreviation]);
}); });
@Effect({ dispatch: false })remove$: any = this.actions$ @Effect({ dispatch: false }) remove$: any = this.actions$
.ofType(KeymapActions.REMOVE) .ofType(KeymapActions.REMOVE)
.withLatestFrom(this.store) .withLatestFrom(this.store)
.do((latest) => { .do((latest) => {
@@ -50,11 +50,10 @@ export class KeymapEffects {
@Effect({ dispatch: false }) editAbbr$: any = this.actions$ @Effect({ dispatch: false }) editAbbr$: any = this.actions$
.ofType(KeymapActions.EDIT_ABBR) .ofType(KeymapActions.EDIT_ABBR)
.withLatestFrom(this.store) .map(action => action.payload.newAbbr)
.do((latest) => { .do(newAbbr => {
const state: AppState = latest[1]; this.router.navigate(['/keymap', newAbbr]);
this.router.navigate(['/keymap', state.keymaps.newAbbr]);
}); });
constructor(private actions$: Actions, private router: Router, private store: Store<AppState>) {} constructor(private actions$: Actions, private router: Router, private store: Store<AppState>) { }
} }
-1
View File
@@ -3,7 +3,6 @@ import { Macro } from '../config-serializer/config-items/Macro';
export interface KeymapState { export interface KeymapState {
entities: Keymap[]; entities: Keymap[];
newAbbr?: string;
} }
export interface MacroState { export interface MacroState {
+1 -2
View File
@@ -63,8 +63,7 @@ export default function (state = initialState, action: Action): KeymapState {
}); });
return { return {
entities: newState, entities: newState
newAbbr: abbr
}; };
case KeymapActions.SET_DEFAULT: case KeymapActions.SET_DEFAULT: