feature(theme-basic): add state action dispatchers to state service

pull/2431/head
TheDiaval 6 years ago
parent e875433a57
commit f89bade3a6

@ -1,6 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store'; import { Store } from '@ngxs/store';
import { LayoutState } from '../states/layout.state'; import { LayoutState } from '../states/layout.state';
import { AddNavigationElement, RemoveNavigationElementByName } from '../actions';
import { Layout } from '../models/layout';
@Injectable() @Injectable()
export class LayoutStateService { export class LayoutStateService {
@ -9,4 +11,12 @@ export class LayoutStateService {
getNavigationElements() { getNavigationElements() {
return this.store.selectSnapshot(LayoutState.getNavigationElements); return this.store.selectSnapshot(LayoutState.getNavigationElements);
} }
dispatchAddNavigationElement(payload: Layout.NavigationElement | Layout.NavigationElement[]) {
return this.store.dispatch(new AddNavigationElement(payload));
}
dispatchRemoveNavigationElementByName(name: string) {
return this.store.dispatch(new RemoveNavigationElementByName(name));
}
} }

Loading…
Cancel
Save