loop-modules
Version:
Shared modules for the Loop product suite.
48 lines (42 loc) • 1.1 kB
text/typescript
// libs
import { Observable } from 'rxjs/Observable';
// app
import { LoopUser } from '../interfaces/loop-user.interface';
import { AppState } from './app.state';
/**
* The AppState slice for persisting Employee records
*
* @export
* @interface EmployeeState
*/
export interface EmployeeState {
/**
* The collection of loaded LoopUser entries from the back-end service
*
* @type {Array<any>}
*/
entries: LoopUser[];
/**
* The collection of selected LoopUser objects
*
* @type {LoopUser[]} The LoopUser objects
*/
selectedEntries?: LoopUser[];
/**
* The active LoopUser we are looking at
*
* @type {LoopUser}
*/
active?: LoopUser;
}
export const initialState: EmployeeState = {
entries: [],
selectedEntries: [],
active: undefined
};
export function getEmployees(state$: Observable<AppState>) {
return state$.select(state => state.employees.entries);
}
export function getSelectedEmployees(state$: Observable<AppState>) {
return state$.select(state => state.employees.selectedEntries);
}