Activities: empty gpx data

This commit is contained in:
Sam 2018-05-04 22:30:11 +02:00
parent 1f8cefdf00
commit 775662af6a
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,7 @@ export function addActivity(form) {
} }
export function getActivityGpx(activityId) { export function getActivityGpx(activityId) {
if (activityId) {
return function(dispatch) { return function(dispatch) {
return mpwoApi return mpwoApi
.getActivityGpx(activityId) .getActivityGpx(activityId)
@ -35,4 +36,8 @@ export function getActivityGpx(activityId) {
}) })
.catch(error => dispatch(setError(`activities: ${error}`))) .catch(error => dispatch(setError(`activities: ${error}`)))
} }
}
return function(dispatch) {
dispatch(setGpx(null))
}
} }

View File

@ -18,6 +18,10 @@ class ActivityMap extends React.Component {
this.props.loadActivityGpx(this.props.activity.id) this.props.loadActivityGpx(this.props.activity.id)
} }
componentWillUnmount() {
this.props.loadActivityGpx(null)
}
render() { render() {
const { gpxContent } = this.props const { gpxContent } = this.props
const { jsonData, bounds } = getGeoJson(gpxContent) const { jsonData, bounds } = getGeoJson(gpxContent)