2 * Created by ob0695 on 7/17/2018.
4 import {State, Action, StateContext} from '@ngxs/store';
5 import {UpdateIsDesigner, UpdateIsViewOnly} from "../actions/workspace.action";
6 import {Selector} from "@ngxs/store";
8 export interface WorkspaceStateModel {
13 @State<WorkspaceStateModel>({
21 export class WorkspaceState {
25 @Selector() static isViewOnly(state: WorkspaceStateModel):boolean {
26 return state.isViewOnly;
28 @Selector() static isDesigner(state: WorkspaceStateModel): boolean {
29 return state.isDesigner;
32 @Action(UpdateIsViewOnly)
33 updateIsViewOnly({getState, setState}: StateContext<WorkspaceStateModel>, action:UpdateIsViewOnly) {
34 const state = getState();
37 isViewOnly: action.isViewOnly
41 @Action(UpdateIsDesigner)
42 updateIsDesigner({getState, patchState}: StateContext<WorkspaceStateModel>, action:UpdateIsDesigner) {
43 const state = getState();
45 isDesigner: action.isDesigner