HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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 }