Redirect to specific URL of favourite keymap

This commit is contained in:
NejcZdovc
2016-11-17 09:08:13 +01:00
committed by József Farkas
parent 0383c50dbc
commit 646cb64a8a

View File

@@ -28,12 +28,13 @@ export class KeymapEffects {
.ofType(KeymapActions.REMOVE)
.withLatestFrom(this.store)
.do((latest) => {
let state: AppState = latest[1];
const state: AppState = latest[1];
if (state.keymaps.entities.length === 0) {
this.router.navigate(['/keymap/add']);
} else {
this.router.navigate(['/keymap']);
let favourite: Keymap = state.keymaps.entities.find(keymap => keymap.isDefault);
this.router.navigate(['/keymap', favourite.abbreviation]);
}
});
@@ -41,7 +42,7 @@ export class KeymapEffects {
.ofType(KeymapActions.EDIT_ABBR)
.withLatestFrom(this.store)
.do((latest) => {
let state: AppState = latest[1];
const state: AppState = latest[1];
this.router.navigate(['/keymap', state.keymaps.newAbbr]);
});