25 lines
668 B
TypeScript
25 lines
668 B
TypeScript
import { Selector, createSelector } from '@ngrx/store';
|
|
|
|
import { RESTClientError } from '@loafer/ng-rest';
|
|
import { Member } from '@overflow/commons-typescript/model/member';
|
|
|
|
export interface State {
|
|
member: Member;
|
|
pending: boolean;
|
|
error: RESTClientError;
|
|
}
|
|
|
|
export const initialState: State = {
|
|
member: null,
|
|
pending: false,
|
|
error: null,
|
|
};
|
|
|
|
export function getSelectors(selector: Selector<any, State>) {
|
|
return {
|
|
selectMember: createSelector(selector, (state: State) => state.member),
|
|
selectPending: createSelector(selector, (state: State) => state.pending),
|
|
selectError: createSelector(selector, (state: State) => state.error),
|
|
};
|
|
}
|