No macro text and route update

This commit is contained in:
Farkas József
2016-12-05 18:20:33 +01:00
committed by József Farkas
parent f887dc8a96
commit 03ca90d558
11 changed files with 28 additions and 14 deletions
+3 -10
View File
@@ -1,6 +1,7 @@
import '@ngrx/core/add/operator/select';
import { Action } from '@ngrx/store';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
@@ -13,7 +14,7 @@ const initialState: MacroState = {
entities: []
};
export default function(state = initialState, action: Action): MacroState {
export default function (state = initialState, action: Action): MacroState {
let newMacro: Macro;
let newState: Macro[];
@@ -149,15 +150,7 @@ export function getMacroEntities(): (state$: Observable<AppState>) => Observable
export function getMacro(id: number) {
if (isNaN(id)) {
return (state$: Observable<AppState>) => state$
.select(appState => appState.macros.entities)
.map((macros: Macro[]) => {
if (macros.length > 0) {
return macros[0];
} else {
return undefined;
}
});
return () => Observable.of<Macro>(undefined);
} else {
return (state$: Observable<AppState>) => state$
.select(appState => appState.macros.entities)