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) {
|
2018-06-07 19:28:06 +02:00
|
|
|
url += '?'
|
|
|
|
Object.keys(data).map(key => url += `&${key}=${data[key]}`)
|
2018-06-06 20:17:37 +02:00
|
|
|
}
|
|
|
|
const params = {
|
|
|
|
url: url,
|
|
|
|
method: 'GET',
|
|
|
|
}
|
|
|
|
return createRequest(params)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|