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.
29 lines
855 B
29 lines
855 B
import { AnyAction } from 'redux'
|
|
import { ThunkDispatch } from 'redux-thunk'
|
|
import { connect } from 'react-redux'
|
|
|
|
import { fetchGroup } from 'src/actions/directory'
|
|
import { getEntity } from 'src/selectors'
|
|
import { AppState } from 'src/types'
|
|
|
|
import RegisterGroup, { Props } from './register-group'
|
|
|
|
const mapStateToProps = (state: AppState, ownProps: Props) => ({
|
|
group: getEntity(state, 'group', ownProps.match.params.id),
|
|
})
|
|
|
|
const mapDispatchToProps = (dispatch: ThunkDispatch<AppState, void, AnyAction>, ownProps: Props) => ({
|
|
fetchGroup: async () => {
|
|
try {
|
|
await dispatch(fetchGroup(ownProps.match.params.id))
|
|
} catch (err) {
|
|
console.error('Expected error')
|
|
console.error(err)
|
|
}
|
|
},
|
|
})
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(RegisterGroup)
|