Commit 0fd4d76c authored by Florent Chehab's avatar Florent Chehab

Tweaks and info provider now provides universities and countries

parent 72edc3c0
......@@ -15,7 +15,6 @@ import GenericGroupModule from '../shared/GenericGroupModule';
import CountryDriEditor from '../editors/CountryDriEditor';
import {
countriesFetchData,
countryDriFetchData,
countryDriInvalidated,
} from '../../../generated/actions';
......@@ -63,8 +62,7 @@ class CountryDri extends MyComponent {
myRender() {
const countryDriItems = this.getFetchedData('countryDri');
const countries = this.getFetchedData('countries')
const { classes } = this.props;
const { countries, classes } = this.props;
const outsideData = {
countries
......@@ -116,7 +114,6 @@ CountryDri.propTypes = {
const mapStateToProps = (state) => {
return {
countryDri: state.countryDri,
countries: state.countries,
};
};
......@@ -124,9 +121,8 @@ const mapDispatchToProps = (dispatch) => {
return {
fetchData: {
countryDri: (countryId) => dispatch(countryDriFetchData(countryId)),
countries: () => dispatch(countriesFetchData()),
},
invalidateData: (resetObj=false) => dispatch(countryDriInvalidated(true, resetObj))
invalidateData: (resetObj = false) => dispatch(countryDriInvalidated(true, resetObj))
};
};
......
......@@ -15,7 +15,6 @@ import GenericGroupModule from '../shared/GenericGroupModule';
import UniversityDriEditor from '../editors/UniversityDriEditor';
import {
universitiesFetchData,
universityDriFetchData,
universityDriInvalidated,
} from '../../../generated/actions';
......@@ -66,8 +65,7 @@ class UniversityDri extends MyComponent {
myRender() {
const univDriItems = this.getFetchedData('universityDri');
const universities = this.getFetchedData('universities')
const { classes } = this.props;
const { universities, classes } = this.props;
const outsideData = {
universities
......@@ -119,7 +117,6 @@ UniversityDri.propTypes = {
const mapStateToProps = (state) => {
return {
universityDri: state.universityDri,
universities: state.universities,
};
};
......@@ -127,7 +124,6 @@ const mapDispatchToProps = (dispatch) => {
return {
fetchData: {
universityDri: (univId) => dispatch(universityDriFetchData(univId)),
universities: () => dispatch(universitiesFetchData()),
},
invalidateData: (resetObj = false) => dispatch(universityDriInvalidated(true, resetObj))
};
......
......@@ -8,6 +8,7 @@ import __pick from 'lodash/pick';
import MyComponent from '../../MyComponent';
import {
universitiesFetchData,
citiesFetchData,
countriesFetchData,
mainCampusesFetchData,
......@@ -17,8 +18,12 @@ import {
class InfoProvider extends MyComponent {
myRender() {
const { city, country } = this.getUnivCityAndCountry(this.props.univId);
const universities = this.getFetchedData('universities');
const countries = this.getFetchedData('countries');
const propsToAdd = {
universities,
countries,
cityId: city.id,
countryId: country.id,
city: city,
......@@ -38,7 +43,8 @@ const mapStateToProps = (state) => {
return {
countries: state.countries,
cities: state.cities,
mainCampuses: state.mainCampuses
mainCampuses: state.mainCampuses,
universities: state.universities,
};
};
......@@ -48,6 +54,7 @@ const mapDispatchToProps = (dispatch) => {
countries: () => dispatch(countriesFetchData()),
cities: () => dispatch(citiesFetchData()),
mainCampuses: () => dispatch(mainCampusesFetchData()),
universities: () => dispatch(universitiesFetchData()),
},
};
};
......
......@@ -4,7 +4,6 @@ import withStyles from '@material-ui/core/styles/withStyles';
import MyComponent from '../../MyComponent';
import compose from 'recompose/compose';
import GenericModule from '../shared/GenericModule';
import Grid from '@material-ui/core/Grid';
......@@ -51,6 +50,8 @@ class GeneralInfoTab extends MyComponent {
univId={this.props.univId}
renderAndAddPropsTo={UniversityDri}
/>
</Grid>
<Grid item xs>
<InfoProvider
univId={this.props.univId}
renderAndAddPropsTo={CountryDri}
......@@ -88,6 +89,8 @@ class GeneralInfoTab extends MyComponent {
univId={this.props.univId}
renderAndAddPropsTo={UniversityDri}
/>
</Grid>
<Grid item xs={12}>
<InfoProvider
univId={this.props.univId}
renderAndAddPropsTo={CountryDri}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment