allocation.js 534 B

123456789101112131415161718192021
  1. import axios from 'axios';
  2. class AllocationService {
  3. BASE_URL = 'http://localhost:9090/model/allocation';
  4. async fetchAllocation(win, aggregate, options) {
  5. const { accumulate, filters, } = options;
  6. const params = {
  7. window: win,
  8. aggregate: aggregate,
  9. step: '1d',
  10. };
  11. if (typeof accumulate === 'boolean') {
  12. params.accumulate = accumulate;
  13. }
  14. const result = await axios.get(`${this.BASE_URL}/compute`, { params });
  15. return result.data;
  16. }
  17. }
  18. export default new AllocationService();