feat(core): add set environment action to config state

pull/2822/head
TheDiaval 6 years ago
parent abfb823fc2
commit a601a10d9a

@ -1,4 +1,5 @@
import { ABP } from '../models/common';
import { Config } from '../models/config';
export class PatchRouteByName {
static readonly type = '[Config] Patch Route By Name';
@ -16,3 +17,8 @@ export class AddRoute {
static readonly type = '[Config] Add Route';
constructor(public payload: Omit<ABP.Route, 'children'>) {}
}
export class SetEnvironment {
static readonly type = '[Config] Set Environment';
constructor(public environment: Config.Environment) {}
}

@ -2,7 +2,12 @@ import { Action, createSelector, Selector, State, StateContext, Store } from '@n
import { of } from 'rxjs';
import { switchMap, tap } from 'rxjs/operators';
import snq from 'snq';
import { GetAppConfiguration, PatchRouteByName, AddRoute } from '../actions/config.actions';
import {
GetAppConfiguration,
PatchRouteByName,
AddRoute,
SetEnvironment,
} from '../actions/config.actions';
import { SetLanguage } from '../actions/session.actions';
import { ABP } from '../models/common';
import { Config } from '../models/config';
@ -291,6 +296,13 @@ export class ConfigState {
flattedRoutes,
});
}
@Action(SetEnvironment)
setEnvironment({ patchState }: StateContext<Config.State>, environment: Config.Environment) {
return patchState({
environment,
});
}
}
function patchRouteDeep(

Loading…
Cancel
Save