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.
27 lines
814 B
27 lines
814 B
import { connect } from 'react-redux'
|
|
|
|
import { handleApiError } from 'src/api/errors'
|
|
import { fetchGroup } from 'src/actions/directory'
|
|
import { getEntity } from 'src/selectors/entities'
|
|
import { AppState, AppThunkDispatch } from 'src/types'
|
|
|
|
import RegisterGroup, { Props } from './register-group'
|
|
|
|
const mapStateToProps = (state: AppState, ownProps: Props) => ({
|
|
group: getEntity(state, 'groups', ownProps.match.params.id),
|
|
})
|
|
|
|
const mapDispatchToProps = (dispatch: AppThunkDispatch, ownProps: Props) => ({
|
|
fetchGroup: async () => {
|
|
try {
|
|
await dispatch(fetchGroup(ownProps.match.params.id))
|
|
} catch (err) {
|
|
handleApiError(err, dispatch, ownProps.history)
|
|
}
|
|
},
|
|
})
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(RegisterGroup)
|