[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.
 
 

26 lines
817 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, EntityType, Group, AppThunkDispatch } from 'src/types'
import GroupPage, { Props } from './group'
const mapStateToProps = (state: AppState, ownProps: Props) => ({
group: getEntity<Group>(state, EntityType.Group, ownProps.match.params.id),
})
const mapDispatchToProps = (dispatch: AppThunkDispatch, ownProps: Props) => ({
fetchGroup: () => {
try {
dispatch(fetchGroup(ownProps.match.params.id))
} catch (err) {
handleApiError(err, dispatch, ownProps.history)
}
}
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(GroupPage)