member_webapp/@overflow/member/store/container/signin/member-signin.state.ts

25 lines
668 B
TypeScript
Raw Normal View History

2018-05-28 07:51:33 +00:00
import { Selector, createSelector } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
2018-05-28 11:39:58 +00:00
import { Member } from '@overflow/commons-typescript/model/member';
2018-05-28 07:51:33 +00:00
export interface State {
2018-05-28 11:39:58 +00:00
member: Member;
2018-05-28 07:51:33 +00:00
pending: boolean;
error: RESTClientError;
}
export const initialState: State = {
2018-05-28 11:39:58 +00:00
member: null,
2018-05-28 07:51:33 +00:00
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
2018-05-28 11:39:58 +00:00
selectMember: createSelector(selector, (state: State) => state.member),
2018-05-28 07:51:33 +00:00
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};
}