Redirect to specific URL of first macro

This commit is contained in:
NejcZdovc
2016-11-17 09:09:35 +01:00
committed by József Farkas
parent 646cb64a8a
commit 02db20e6c3
8 changed files with 15 additions and 23 deletions

View File

@@ -33,7 +33,7 @@ export class KeymapEffects {
if (state.keymaps.entities.length === 0) {
this.router.navigate(['/keymap/add']);
} else {
let favourite: Keymap = state.keymaps.entities.find(keymap => keymap.isDefault);
const favourite: Keymap = state.keymaps.entities.find(keymap => keymap.isDefault);
this.router.navigate(['/keymap', favourite.abbreviation]);
}
});

View File

@@ -19,12 +19,12 @@ export class MacroEffects {
.ofType(MacroActions.REMOVE)
.withLatestFrom(this.store)
.do((latest) => {
let state: AppState = latest[1];
const state: AppState = latest[1];
if (state.macros.entities.length === 0) {
this.router.navigate(['/macro/add']);
} else {
this.router.navigate(['/macro']);
this.router.navigate(['/macro', '0']);
}
});
@@ -32,8 +32,8 @@ export class MacroEffects {
.ofType(MacroActions.ADD)
.withLatestFrom(this.store)
.do((latest) => {
let state: AppState = latest[1];
let macro: Macro = state.macros.entities[state.macros.entities.length - 1];
const state: AppState = latest[1];
const macro: Macro = state.macros.entities[state.macros.entities.length - 1];
this.router.navigate(['/macro', macro.id, 'new']);
});