loop-modules
Version:
Shared modules for the Loop product suite.
36 lines (30 loc) • 873 B
text/typescript
// libs
import { Observable } from 'rxjs/Observable';
// app
import { LoopAssignment } from '../interfaces/loop-assignment.interface';
import { AppState } from './app.state';
/**
* The AppState slice for persisting LoopAssignment records
*
* @export
* @interface LoopAssignmentState
*/
export interface LoopAssignmentState {
/**
* The collection of loaded LoopAssignment entries from the back-end service
*
* @type {Array<LoopAssignment>}
*/
entries: LoopAssignment[];
unread: number;
}
export const initialState: LoopAssignmentState = {
entries: [],
unread: 0
};
export function getAssignments(state$: Observable<AppState>) {
return state$.select(state => state.assignments.entries);
}
export function getUnreadAssignments(state$: Observable<AppState>) {
return state$.select(state => state.assignments.unread);
}