2018-05-28 12:37:47 +00:00
|
|
|
import { Selector, createSelector } from '@ngrx/store';
|
2018-05-29 09:32:22 +00:00
|
|
|
import { RPCClientError } from '@loafer/ng-rpc';
|
2018-05-28 12:37:47 +00:00
|
|
|
|
|
|
|
export interface State {
|
|
|
|
secretKey: string;
|
|
|
|
sourceURI: string;
|
|
|
|
pending: boolean;
|
2018-05-29 09:32:22 +00:00
|
|
|
error: RPCClientError;
|
2018-05-28 12:37:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const initialState: State = {
|
|
|
|
secretKey: null,
|
|
|
|
sourceURI: null,
|
|
|
|
pending: false,
|
|
|
|
error: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export function getSelectors(selector: Selector<any, State>) {
|
|
|
|
return {
|
|
|
|
selectSecretKey: createSelector(selector, (state: State) => state.secretKey),
|
|
|
|
selectSourceURI: createSelector(selector, (state: State) => state.sourceURI),
|
|
|
|
selectPending: createSelector(selector, (state: State) => state.pending),
|
|
|
|
selectError: createSelector(selector, (state: State) => state.error),
|
|
|
|
};
|
|
|
|
}
|