2018-06-06 20:17:37 +02:00
|
|
|
import { apiUrl, createRequest } from '../utils'
|
|
|
|
|
2018-06-07 14:45:43 +02:00
|
|
|
export default class FitTrackeeApi {
|
2018-06-06 20:17:37 +02:00
|
|
|
|
|
|
|
static getStats(userID, type, data = {}) {
|
|
|
|
let url = `${apiUrl}stats/${userID}/${type}`
|
|
|
|
if (Object.keys(data).length > 0) {
|
|
|
|
url = `${url}?${
|
|
|
|
data.start ? `&from=${data.start}` : ''
|
|
|
|
}${
|
|
|
|
data.end ? `&to=${data.end}` : ''
|
|
|
|
}${
|
|
|
|
data.time ? `&time=${data.time}` : ''
|
|
|
|
}${
|
|
|
|
data.sport_id ? `&sport_id=${data.sport_id}` : ''
|
|
|
|
}`
|
|
|
|
}
|
|
|
|
const params = {
|
|
|
|
url: url,
|
|
|
|
method: 'GET',
|
|
|
|
}
|
|
|
|
return createRequest(params)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|