Files
leadchat/app/javascript/src/api/reports.js
Pranav Raj S 2c144d5ad3 Setup Circle CI, add brakeman config (#13)
* Add circle ci config

* Change config to fix tests

* Update config

* Fix eslint command, add brakeman
2019-08-21 12:59:56 +05:30

35 lines
855 B
JavaScript

/* global axios */
import endPoints from './endPoints';
export default {
getAccountReports(metric, from, to) {
const urlData = endPoints('reports').account(metric, from, to);
const fetchPromise = new Promise((resolve, reject) => {
axios
.get(urlData.url)
.then(response => {
resolve(response);
})
.catch(error => {
reject(Error(error));
});
});
return fetchPromise;
},
getAccountSummary(accountId, from, to) {
const urlData = endPoints('reports').accountSummary(accountId, from, to);
const fetchPromise = new Promise((resolve, reject) => {
axios
.get(urlData.url)
.then(response => {
resolve(response);
})
.catch(error => {
reject(Error(error));
});
});
return fetchPromise;
},
};