const routes = {
    origin: window.location.origin,
}

export function callAction(payload, callback, ...args) {
    $.ajax({
        url: `${routes.origin}${payload.link}`,
        method: payload.type,
        headers: payload.headers ? payload.headers : {},
        data: payload.data ? payload.data : {},
        success: function (data) {
            callback(data, ...args);
        },
    });
}
