UNPKG

trc-client-core

Version:
43 lines (40 loc) 1.28 kB
import Reflux from 'reflux'; import ImmutableStoreMixin from 'reflux-immutable/ImmutableStoreMixin'; import SurveyActions from 'trc-client-core/src/report/SurveyActions'; var SurveyStore = Reflux.createStore({ listenables: SurveyActions, mixins: [ImmutableStoreMixin], init() { this.setState({ notificationsList: [], notificationsListLoading: false, possibleCourses: [], surveyCodes: [] }); }, mapToSelectShape(item) { return {label: item, value:item}; }, onGetNotificationList() { this.setState({ notificationsListLoading: true }); }, onGetNotificationListCompleted(data) { this.setState({ notificationsList: data, notificationsListLoading: false }); }, onGetPossibleCoursesCompleted(data) { this.setState({ possibleCourses: [{label:'All Courses', value: undefined}].concat(data.map(this.mapToSelectShape)) }); }, onGetSurveyCodesCompleted(data) { this.setState({ surveyCodes: [{label:'All Id\'s', value: undefined}].concat(data.map(this.mapToSelectShape)) }); } }); module.exports = SurveyStore;