File: D:/HostingSpaces/SBogers10/shop.komma.nl/resources/js/services/discountService.js
import { axios } from '../../../vendor/komma/kms/resources/js/global/axiosBootstrapper';
/**
* The checkout service knows how to do api calls and handle the responses from the api.
* All related to the checkout process. It does not do anything with the DOM.
*/
class DiscountService {
constructor() {
this._baseRoute = '/kms/discounts/';
}
discounts() {
return axios.get(
this._baseRoute
);
}
conditionDataByType() {
return axios.get(
this._baseRoute+'condition_data_by_type'
);
}
actionDataByType() {
return axios.get(
this._baseRoute+'action_data_by_type'
);
}
weatherInfo() {
return axios.get(
this._baseRoute+'weather_info'
)
}
update(discounts) {
if(!Array.isArray(discounts)) discounts = [discounts];
return axios.put(
this._baseRoute, discounts
)
}
sortDiscountsById(sortOrderData) {
return axios.put(this._baseRoute+'sort_order', {
sortOrderData
})
}
}
export { DiscountService }