Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
6ff038f3
Commit
6ff038f3
authored
Sep 16, 2018
by
Florent Chehab
Browse files
Fixed data invalidation on unmount
parent
8583ed58
Changes
8
Hide whitespace changes
Inline
Side-by-side
frontend/generate/templates/actions.tpl
View file @
6ff038f3
...
...
@@ -50,10 +50,7 @@ export function {{obj.name}}IsLoading(bool) {
};
}
export function {
{
obj
.
name
}
}Invalidated(bool, resetObj=false) {
if (resetObj){
{
{
obj
.
name
}
}FetchDataSuccess({}, false);
}
export function {
{
obj
.
name
}
}Invalidated(bool) {
return {
type: {
{
obj
.
NAME
}
}_INVALIDATED,
invalidated: bool
...
...
@@ -96,11 +93,7 @@ export function {{obj.name}}ElFetchHasError(bool, error) {
};
}
export function {
{
obj
.
name
}
}ElInvalidated(bool, resetObj=false) {
if (resetObj){
{
{
obj
.
name
}
}ElFetchDataSuccess({}, false);
}
export function {
{
obj
.
name
}
}ElInvalidated(bool) {
return {
type: {
{
obj
.
NAME
}
}_EL_INVALIDATED,
invalidated: bool
...
...
frontend/src/components/university/modules/CountryDri.js
View file @
6ff038f3
...
...
@@ -7,7 +7,7 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
Module
from
'
../shared/Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -17,6 +17,7 @@ import CountryDriEditor from '../editors/CountryDriEditor';
import
{
countryDriFetchData
,
countryDriInvalidated
,
countryDriFetchDataSuccess
,
}
from
'
../../../generated/actions
'
;
const
styles
=
theme
=>
({
...
...
@@ -110,7 +111,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
countryDri
:
(
countryId
)
=>
dispatch
(
countryDriFetchData
(
countryId
)),
},
invalidateData
:
(
resetObj
=
false
)
=>
dispatch
(
countryDriInvalidated
(
true
,
resetObj
)
)
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
countryDriInvalidated
,
countryDriFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/modules/CountryScholarships.js
View file @
6ff038f3
...
...
@@ -5,7 +5,7 @@ import compose from 'recompose/compose';
import
{
connect
}
from
"
react-redux
"
;
import
__pick
from
'
lodash/pick
'
;
import
Module
from
'
../shared/Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -15,6 +15,7 @@ import CountryScholarshipsEditor from '../editors/CountryScholarshipsEditor';
import
{
countryScholarshipsFetchData
,
countryScholarshipsFetchDataSuccess
,
countryScholarshipsInvalidated
,
}
from
'
../../../generated/actions
'
;
...
...
@@ -131,7 +132,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
countryScholarships
:
(
countryId
)
=>
dispatch
(
countryScholarshipsFetchData
(
countryId
)),
},
invalidateData
:
(
resetObj
=
false
)
=>
dispatch
(
countryScholarshipsInvalidated
(
true
,
resetObj
)
)
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
countryScholarshipsInvalidated
,
countryScholarshipsFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/modules/UniversityDri.js
View file @
6ff038f3
...
...
@@ -7,7 +7,7 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
Module
from
'
../shared/Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -17,6 +17,7 @@ import UniversityDriEditor from '../editors/UniversityDriEditor';
import
{
universityDriFetchData
,
universityDriInvalidated
,
universityDriFetchDataSuccess
,
}
from
'
../../../generated/actions
'
;
const
styles
=
theme
=>
({
...
...
@@ -113,7 +114,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
universityDri
:
(
univId
)
=>
dispatch
(
universityDriFetchData
(
univId
)),
},
invalidateData
:
(
resetObj
=
false
)
=>
dispatch
(
universityDriInvalidated
(
true
,
resetObj
)
)
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
universityDriInvalidated
,
universityDriFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/modules/UniversityGeneral.js
View file @
6ff038f3
...
...
@@ -8,19 +8,20 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
Module
from
'
../shared/Module
'
;
import
Generic
Module
from
'
../shared/
Generic
Module
'
;
import
TextLink
from
'
../../other/TextLink
'
;
import
Grid
from
'
@material-ui/core/Grid
'
;
import
Divider
from
'
@material-ui/core/Divider
'
;
import
PhotoSizeSelectActualIcon
from
'
@material-ui/icons/PhotoSizeSelectActual
'
;
import
GenericModule
from
'
../shared/
Generic
Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
UniversityGeneralEditor
from
'
../editors/UniversityGeneralEditor
'
;
import
{
universitiesElFetchData
,
universitiesElInvalidated
,
universitiesElFetchDataSuccess
,
}
from
'
../../../generated/actions
'
;
const
styles
=
theme
=>
({
...
...
@@ -128,7 +129,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
universitiesEl
:
(
univId
)
=>
dispatch
(
universitiesElFetchData
(
univId
)),
},
invalidateData
:
()
=>
dispatch
(
universitiesElInvalidated
(
true
,
true
)
)
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
universitiesElInvalidated
,
universitiesElFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/modules/UniversityScholarships.js
View file @
6ff038f3
...
...
@@ -5,7 +5,7 @@ import compose from 'recompose/compose';
import
{
connect
}
from
"
react-redux
"
;
import
__pick
from
'
lodash/pick
'
;
import
Module
from
'
../shared/Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -16,6 +16,7 @@ import UniversityScholarshipsEditor from '../editors/UniversityScholarshipsEdito
import
{
universityScholarshipsFetchData
,
universityScholarshipsInvalidated
,
universityScholarshipsFetchDataSuccess
,
}
from
'
../../../generated/actions
'
;
const
styles
=
theme
=>
({
...
...
@@ -130,7 +131,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
universityScholarships
:
(
univId
)
=>
dispatch
(
universityScholarshipsFetchData
(
univId
)),
},
invalidateData
:
(
resetObj
=
false
)
=>
dispatch
(
universityScholarshipsInvalidated
(
true
,
resetObj
)
)
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
universityScholarshipsInvalidated
,
universityScholarshipsFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/modules/UniversitySemestersDates.js
View file @
6ff038f3
...
...
@@ -17,7 +17,7 @@ import LocalFloristIcon from '@material-ui/icons/LocalFlorist';
import
GenericModule
from
'
../shared/GenericModule
'
;
import
Module
from
'
../shared/Module
'
;
import
Module
,
{
getInvalidateDataFunction
}
from
'
../shared/Module
'
;
import
dateStrToStr
from
'
../../../utils/dateStrToStr
'
;
...
...
@@ -26,6 +26,7 @@ import UniversitySemestersDatesEditor from '../editors/UniversitySemestersDatesE
import
{
universitiesSemestersDatesElFetchData
,
universitiesSemestersDatesElInvalidated
,
universitiesSemestersDatesElFetchDataSuccess
,
}
from
'
../../../generated/actions
'
;
const
styles
=
theme
=>
({
...
...
@@ -165,7 +166,7 @@ const mapDispatchToProps = (dispatch) => {
fetchData
:
{
universitiesSemestersDatesEl
:
(
univId
)
=>
dispatch
(
universitiesSemestersDatesElFetchData
(
univId
)),
},
invalidateData
:
()
=>
dispatch
(
universitiesSemestersDatesElInvalidated
(
true
,
true
)),
invalidateData
:
getInvalidateDataFunction
(
dispatch
,
universitiesSemestersDatesElInvalidated
,
universitiesSemestersDatesElFetchDataSuccess
)
};
};
...
...
frontend/src/components/university/shared/Module.js
View file @
6ff038f3
...
...
@@ -19,4 +19,13 @@ class Module extends MyComponent {
}
export
default
Module
;
\ No newline at end of file
export
default
Module
;
export
function
getInvalidateDataFunction
(
dispatch
,
invalidated
,
fetchDataSuccess
)
{
return
(
resetObj
=
false
)
=>
{
dispatch
(
invalidated
(
true
));
if
(
resetObj
)
{
dispatch
(
fetchDataSuccess
({},
false
));
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment