Client - display segments - #14
This commit is contained in:
@ -81,6 +81,22 @@ export const getActivityGpx = activityId => dispatch => {
|
||||
dispatch(setGpx(null))
|
||||
}
|
||||
|
||||
export const getSegmentGpx = (activityId, segmentId) => dispatch => {
|
||||
if (activityId) {
|
||||
return FitTrackeeGenericApi
|
||||
.getData(`activities/${activityId}/gpx/segment/${segmentId}`)
|
||||
.then(ret => {
|
||||
if (ret.status === 'success') {
|
||||
dispatch(setGpx(ret.data.gpx))
|
||||
} else {
|
||||
dispatch(setError(`activities: ${ret.message}`))
|
||||
}
|
||||
})
|
||||
.catch(error => dispatch(setError(`activities: ${error}`)))
|
||||
}
|
||||
dispatch(setGpx(null))
|
||||
}
|
||||
|
||||
|
||||
export const getActivityChartData = activityId => dispatch => {
|
||||
if (activityId) {
|
||||
@ -98,6 +114,22 @@ export const getActivityChartData = activityId => dispatch => {
|
||||
dispatch(setChartData(null))
|
||||
}
|
||||
|
||||
export const getSegmentChartData = (activityId, segmentId) => dispatch => {
|
||||
if (activityId) {
|
||||
return FitTrackeeGenericApi
|
||||
.getData(`activities/${activityId}/chart_data/segment/${segmentId}`)
|
||||
.then(ret => {
|
||||
if (ret.status === 'success') {
|
||||
dispatch(setChartData(formatChartData(ret.data.chart_data)))
|
||||
} else {
|
||||
dispatch(setError(`activities: ${ret.message}`))
|
||||
}
|
||||
})
|
||||
.catch(error => dispatch(setError(`activities: ${error}`)))
|
||||
}
|
||||
dispatch(setChartData(null))
|
||||
}
|
||||
|
||||
|
||||
export const deleteActivity = id => dispatch => FitTrackeeGenericApi
|
||||
.deleteData('activities', id)
|
||||
|
Reference in New Issue
Block a user