Activities: empty gpx data
This commit is contained in:
parent
1f8cefdf00
commit
775662af6a
@ -23,7 +23,8 @@ export function addActivity(form) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getActivityGpx(activityId) {
|
export function getActivityGpx(activityId) {
|
||||||
return function(dispatch) {
|
if (activityId) {
|
||||||
|
return function(dispatch) {
|
||||||
return mpwoApi
|
return mpwoApi
|
||||||
.getActivityGpx(activityId)
|
.getActivityGpx(activityId)
|
||||||
.then(ret => {
|
.then(ret => {
|
||||||
@ -34,5 +35,9 @@ export function getActivityGpx(activityId) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => dispatch(setError(`activities: ${error}`)))
|
.catch(error => dispatch(setError(`activities: ${error}`)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return function(dispatch) {
|
||||||
|
dispatch(setGpx(null))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user