FitTrackee/fittrackee_client/src/fitTrackeeApi/stats.js

19 lines
415 B
JavaScript
Raw Normal View History

import { apiUrl, createRequest } from '../utils'
export default class FitTrackeeApi {
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]}`)
}
const params = {
url: url,
method: 'GET',
}
return createRequest(params)
}
}