member_webapp/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts
crusader f7cb8333f0 ing
2018-05-31 18:30:58 +09:00

21 lines
752 B
TypeScript

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