const commandSaga = function* (sagaArgs: ChildSagaArgs): any { yield takeEvery( (action: Action) => { if (isSendCommandAction(action)) { return !action.usedByHook } return false }, sendCommandSaga, sagaArgs ) }
handleSubmit(data){ console.log('data from post form: ' + JSON.stringify(data)) this.setState({ type: 'info', message: 'Sending info ...' }); let dispatch = store.dispatch dispatch(createPost(data)) .then( () => { browserHistory.push('/home') }) }
const isSendCommandAction = ( action: Action ): action is SendCommandRequestAction => action.type === SEND_COMMAND_REQUEST
firebase.auth().onAuthStateChanged((user) => { if (user) { store.dispatch(login(user.uid)); store.dispatch(startSetExpenses()).then(() => { renderApp(); if (history.location.pathname === '/') { history.push('/dashboard'); } }); } else { store.dispatch(logout()); renderApp(); history.push('/'); } });
function app([push]) { const store = createStore( rootReducer, composeEnhancers( applyMiddleware(thunkMiddleware), applyMiddleware(samplePlayerMiddleware), persistState('entities', { key: 'push-with-react' }) ) ) push.clearLCD() store.dispatch(init()) .then(() => { ReactDOM.render( <Provider store={store}> <App push={push} /> </Provider>, document.getElementById('app') ) }) }
componentDidMount() { store.dispatch(appOperations.loadAssets()); }
//init data store.dispatch(todoActions.loadInitTodos()).then(function () { var contentHtml = React.renderToString( <Provider store={store}> {function () { return <TodoApp />; }} </Provider> ); var initialState = JSON.stringify(store.getState()); res.render('index.ejs', {contentHtml: contentHtml, initialState: initialState}); }).catch(function(error){ res.json({errMsg: 'internal error'}) });
checkIn() { let valuesPath = 'obs|path=referral|conceptPath=' + CONCEPTS.SOURCE_OF_REFERRAL.uuid; let valuesObj = {}; valuesObj[valuesPath] = CONCEPTS.SOURCE_OF_REFERRAL.IC3_appointment.uuid; this.props.dispatch(formActions.formSubmitted({ formId: "checkin-form", formInstanceId: this.formInstanceId, values: valuesObj, encounterRole: ENCOUNTER_ROLES.UnknownEncounterRole, encounterType: ENCOUNTER_TYPES.CheckInEncounterType, location: this.props.sessionLocation, patient: this.props.patient, formSubmittedActionCreator: [ () => this.props.patient && this.props.patient.uuid && visitActions.fetchPatientActiveVisit(this.props.patient.uuid, this.props.sessionLocation.uuid, ACTIVE_VISITS_REP), () => this.props.patient && this.props.patient.uuid && patientActions.getIC3PatientScreeningData(this.props.patient), () => toastrActions.add({ title: this.props.toastMessage ? this.props.toastMessage : "Data Saved", type: "success" }) ] })); }
yield put({ type: OPTIMISTIC_SHOPPING_LIST_SYNC, payload: action.result, }) type: OPTIMISTIC_SHOPPING_LIST_CREATE, payload: { id: action.aggregateId, name: action.payload.name, }, }) type: OPTIMISTIC_SHOPPING_LIST_REMOVE, payload: { id: action.aggregateId, }, })
BackHandler.addEventListener('hardwareBackPress', this.props.navigateBack); store.dispatch(settingsOperations.checkSettings()); }, componentWillUnmount() {
handleCommentSubmit(data, postId){ // make post comment request, receive post and update list of posts data.postId = postId let dispatch = store.dispatch dispatch(commentPost(data)) .then( (updatedPost) => { if(updatedPost.hasOwnProperty('error')){ alert('error replying to post') }else{ // set state to current post let newPosts = this.state.posts.map( post => { if(post._id != updatedPost._id) return post else return updatedPost }) this.setState({ posts: newPosts }) } }) }
yield put({ type: OPTIMISTIC_SHARINGS_SYNC, payload: action.result, }) type: OPTIMISTIC_SHARINGS_SHOPPING_LIST_SHARE, payload: { id: action.payload.userId, username: action.payload.username, }, }) type: OPTIMISTIC_SHARINGS_SHOPPING_LIST_UNSHARE, payload: { id: action.payload.userId, username: action.payload.username, }, })
componentDidMount(){ let dispatch = store.dispatch dispatch(fetchPosts()) .then( (posts) => { this.setState({ posts: posts }) }) }
yield put({ type: OPTIMISTIC_SHARINGS_SYNC, payload: action.result, }) type: OPTIMISTIC_SHARINGS_SHOPPING_LIST_SHARE, payload: { id: action.payload.userId, username: action.payload.username, }, }) type: OPTIMISTIC_SHARINGS_SHOPPING_LIST_UNSHARE, payload: { id: action.payload.userId, username: action.payload.username, }, })