From 67a924bcf1a247e053ee4f2997be38b7d3b1e91d Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 25 May 2018 21:52:50 +0900 Subject: [PATCH] container store --- .../store/container/probe-list/probe-list.state.ts | 10 +++++++++- @overflow/probe/store/index.ts | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/@overflow/probe/store/container/probe-list/probe-list.state.ts b/@overflow/probe/store/container/probe-list/probe-list.state.ts index cc91b89..236ecca 100644 --- a/@overflow/probe/store/container/probe-list/probe-list.state.ts +++ b/@overflow/probe/store/container/probe-list/probe-list.state.ts @@ -1,7 +1,15 @@ +import { Selector, createSelector } from '@ngrx/store'; +import { createEntityAdapter, EntityState } from '@loafer/ng-entity'; + export interface State { pending: boolean; } - export const initialState: State = { pending: false, }; + +export function getSelectors(selector: Selector) { + return { + selectPending: createSelector(selector, (state: State) => state.pending), + }; +} diff --git a/@overflow/probe/store/index.ts b/@overflow/probe/store/index.ts index c73f431..0b6dd0e 100644 --- a/@overflow/probe/store/index.ts +++ b/@overflow/probe/store/index.ts @@ -13,12 +13,12 @@ import * as ProbeListContainerStore from './container/probe-list'; export interface State { probes: ProbeEntityStore.State; - probe_list_pending: ProbeListContainerStore.State; + probe_list_container: ProbeListContainerStore.State; } export const REDUCERS = { probes: ProbeEntityStore.reducer, - probe_list_pending: ProbeListContainerStore.reducer, + probe_list_container: ProbeListContainerStore.reducer, }; export const EFFECTS = [ @@ -32,4 +32,7 @@ export const ProbeSelector = ProbeEntityStore.getSelectors(createSelector( (state: State) => state.probes )); - +export const ProbeListContainerSelector = ProbeListContainerStore.getSelectors(createSelector( + selectState, + (state: State) => state.probe_list_container +));