member_webapp/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts

21 lines
752 B
TypeScript
Raw Normal View History

2018-05-29 10:17:16 +00:00
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> {
2018-05-31 09:30:58 +00:00
pending: boolean;
2018-05-29 10:17:16 +00:00
}
export const initialState: State = metaCrawlerEntityAdapter.getInitialState({
2018-05-31 09:30:58 +00:00
pending: false,
2018-05-29 10:17:16 +00:00
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaCrawlerEntityAdapter.getSelectors(selector),
2018-05-31 09:30:58 +00:00
selectPending: createSelector(selector, (state: State) => state.pending),
2018-05-29 10:17:16 +00:00
};
}