From e784a6ab0b859374603e3eff72c706ff4521453a Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Sun, 20 Nov 2016 09:39:35 +0100 Subject: [PATCH] Added duplicate redirect --- src/store/effects/keymap.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/store/effects/keymap.ts b/src/store/effects/keymap.ts index 73e48062..40b4620f 100644 --- a/src/store/effects/keymap.ts +++ b/src/store/effects/keymap.ts @@ -24,6 +24,15 @@ export class KeymapEffects { this.router.navigate(['/keymap', entities[entities.length - 1].abbreviation]); }); + @Effect({ dispatch: false }) duplicate$: any = this.actions$ + .ofType(KeymapActions.DUPLICATE) + .withLatestFrom(this.store) + .do((latest) => { + const state: AppState = latest[1]; + const entities: Keymap[] = state.keymaps.entities; + this.router.navigate(['/keymap', entities[entities.length - 1].abbreviation]); + }); + @Effect({ dispatch: false })remove$: any = this.actions$ .ofType(KeymapActions.REMOVE) .withLatestFrom(this.store)