[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
1.0 KiB

import { Dispatch } from 'redux'
import { connect } from 'react-redux'
import { setFieldNotification } from 'src/actions/forms'
import { setStep } from 'src/actions/registration'
import { getFieldValue } from 'src/selectors/forms'
import { AppState } from 'src/types'
import CreateGroupStep from './create-group-step'
const MAX_ID_LENGTH = 40
const mapStateToProps = (state: AppState) => ({
name: getFieldValue<string>(state, 'group-name', ''),
registration: getFieldValue<string>(state, 'group-registration', ''),
})
const mapDispatchToProps = (dispatch: Dispatch) => ({
next: (name: string) => {
if (!name) {
dispatch(setFieldNotification('group-name', 'error', 'This is required'))
return
}
if (name.length > MAX_ID_LENGTH) {
dispatch(setFieldNotification('group-name', 'error', `This must be less than ${MAX_ID_LENGTH} characters`))
return
}
dispatch(setStep(1))
},
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(CreateGroupStep)