Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function* createOrUpdateEvent(form, event) {
try {
// indicate start submitting form
yield put(startSubmit(form))
if (form === 'event-create') {
// get user id
const uid = yield select(getUserId)
// create event into database
const ref = yield call(eventCrud.create, { ...event, owner: uid })
// go to event page
yield put(push(`/organizer/event/${ref.id}`))
// reset form
yield put(reset(form))
} else {
// update event into database
yield call(eventCrud.update, event)
// update event in store
yield put(eventData.update(event))
}
// set form submitted
yield put(stopSubmit(form))
} catch (error) {
yield put(stopSubmit(form, { _error: error.message }))
throw error
}
}
.then(() => {
dispatch(signupSuccess());
hashHistory.push('/login');
dispatch(reset('signup'));
})
.catch(err => dispatch(signupFailure(err.message)));
const fetchConfig = function *() {
while (true) {
yield take(t.FETCH_CONFIG)
yield call(serial.send, SerialCodes.REQUEST_CONFIG)
yield take(t.SERIAL_GOT_CONFIG)
yield put(resetForm('config'))
}
}
onDelete: id => {
dispatch(deleteGroup(id));
dispatch(reset('FormCustomerGroup'));
},
onCreate: () => {
.then((response) => {
setCurrentUser(dispatch, response);
dispatch(reset('signup'));
router.transitionTo('/');
})
.catch((error) => {
export function openSnackbar(results, dispatch, props) {
const form = props.form;
const message = getMessage(props);
dispatch({ type: OPEN_SNACKBAR, message });
dispatch(reset(form));
}
onClick={() => dispatch(reset(formName))}
secondary={true}
componentWillUnmount() {
const { dispatch } = this.props;
dispatch(reset('create-learning-path'));
}