// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.

// Write your JavaScript code.
function getWebConsoleAPI(parameter, callBack) {
    var href = window.location.href;
    var path = window.location.pathname;
    let basicUrl = href.slice(0, href.indexOf(path));
    var serviceUrl = basicUrl + "/u/?apitype=service&an=ShowMeApi&pn=ProcessorsDispatcher&en=Edge.Core.Processor.Dispatcher.DefaultDispatcher";
    $.ajax({
        url: serviceUrl,
        datatype: "application/json",
        type: 'post',
        contentType: "application/json;charset=utf-8;",
        data: JSON.stringify(parameter),
        beforeSend: function () {
        },
        success: function (data) {
            console.log(data);
            if (data !== null && Array.isArray(data) && data.length > 0) {
                if (callBack !== null) callBack(data[0].Path);
            } else {
                if (callBack !== null) callBack(null);
            }

        },
        error: function (err) {
            console.log(err);
            if (callBack !== null) callBack(null);
        }
    });
}