Remove newAbbr from KeymapState
This commit is contained in:
@@ -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>) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user