member_webapp/@overflow/probe/store/container/probe-detail/probe-detail.state.ts
2018-05-28 18:58:13 +09:00

20 lines
752 B
TypeScript

import { RPCClientError } from '@loafer/ng-rpc';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
export const probeListContainerAdapter = createEntityAdapter<ProbeHost, RPCClientError>();
export interface State extends EntityState<ProbeHost, RPCClientError> {
pending: boolean;
}
export const initialState: State = probeListContainerAdapter.getInitialState({
pending: false,
});
export function getSelectors<S>(selector: Selector<any, State>) {
return {
...probeListContainerAdapter.getSelectors(selector),
selectPending: createSelector(selector, (state: State) => state.pending),
};
}