Client - display app statistics in Administration

This commit is contained in:
Sam
2019-09-23 21:05:55 +02:00
parent 628f2f3e27
commit f3356e045c
7 changed files with 128 additions and 3 deletions

View File

@ -1,6 +1,22 @@
import FitTrackeeGenericApi from '../fitTrackeeApi'
import { setData, setError } from './index'
export const setAppStats = data => ({
type: 'SET_APP_STATS',
data,
})
export const getAppStats = () => dispatch =>
FitTrackeeGenericApi.getData('stats/all')
.then(ret => {
if (ret.status === 'success') {
dispatch(setAppStats(ret.data))
} else {
dispatch(setError(`application|${ret.message}`))
}
})
.catch(error => dispatch(setError(`application|${error}`)))
export const getStats = (userId, type, data) => dispatch =>
FitTrackeeGenericApi.getData(`stats/${userId}/${type}`, data)
.then(ret => {