HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/apklausos/assets/packages/adminsidepanel/src/mixins/runAjax.js
export default {
  methods: {
    _runAjax: function(uri, data, method) {
    data =  data || {};
    method =  method || 'get';
      return new Promise(function(resolve, reject) {
        if ($ == undefined) {
          reject('JQUERY NOT AVAILABLE!');
        }
        $.ajax({
          url: uri,
          method: method || 'get',
          data: data,
          dataType: 'json',
          success: function(response, status, xhr) {
            resolve({
              success: true,
              data: response,
              transferStatus: status,
              xhr: xhr
            });
          },
          error: function(xhr, status, error) {
            const responseData = xhr.responseJSON || xhr.responseText;
            reject({
                success: false,
                error: error,
                data: responseData,
                transferStatus: status,
                xhr: xhr
            });
          }
        });
      });
    },
    post: function(uri, data) {
      return this._runAjax(uri, data, 'post');
    },
    get: function(uri, data) {
      return this._runAjax(uri, data, 'get');
    },
    delete: function(uri, data) {
      return this._runAjax(uri, data, 'delete');
    },
    put: function(uri, data) {
      return this._runAjax(uri, data, 'put');
    }
  }
};