Add basic package managing plumbing
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -2,6 +2,7 @@ import { tassign } from 'tassign';
|
||||
import { IItemTypes} from '../models/item.types';
|
||||
import { IListItem } from '../models/list.item';
|
||||
import { IUser } from '../models/user';
|
||||
import { IPackage,IPackages} from '../models/package';
|
||||
import * as appCommonActions from '../actions/app-common.actions';
|
||||
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
|
||||
|
||||
@@ -16,6 +17,7 @@ export interface State {
|
||||
fullScreen: boolean,
|
||||
routeLoading:boolean,
|
||||
menuVisible: boolean,
|
||||
userPackages: IPackages
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
@@ -26,7 +28,8 @@ export const initialState: State = {
|
||||
user:null,
|
||||
fullScreen: true,
|
||||
routeLoading: false,
|
||||
menuVisible: false
|
||||
menuVisible: false,
|
||||
userPackages: {}
|
||||
}
|
||||
|
||||
export function reducer(state = initialState, action: appCommonActions.Actions ): State {
|
||||
@@ -79,6 +82,15 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
let a = action as appCommonActions.SetMenuVisible;
|
||||
return tassign(state, { menuVisible: a.visible });
|
||||
}
|
||||
case appCommonActions.INITUSERPACKAGESSUCCESS:{
|
||||
let a = action as appCommonActions.InitUserPackagesSuccess;
|
||||
let packages = {}
|
||||
a.items.forEach((item) => {
|
||||
packages[item.data.id]=item.data;
|
||||
});
|
||||
|
||||
return tassign(state,{userPackages:packages});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
@@ -93,7 +105,7 @@ export const getFullScreen = (state: State) => state.fullScreen;
|
||||
export const getRouteLoading = (state: State) => state.routeLoading;
|
||||
export const getMenuVisible = (state: State) => state.menuVisible;
|
||||
export const getUser = (state: State) => state.user;
|
||||
|
||||
export const getUserPackages = (state: State) => state.userPackages;
|
||||
|
||||
export const selectAppCommonState = createFeatureSelector<State>(MODULE_NAME);
|
||||
|
||||
@@ -105,4 +117,5 @@ export const selectGetFullScreen = createSelector(selectAppCommonState, getFullS
|
||||
export const selectGetRouteLoading = createSelector(selectAppCommonState, getRouteLoading);
|
||||
export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuVisible);
|
||||
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
|
||||
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
|
||||
|
||||
|
Reference in New Issue
Block a user