src/js/digitalocean.js
// _request makes an authenticated API request to DigitalOcean
_request makes an authenticated API request to DigitalOcean
_request makes an authenticated API request to DigitalOcean
_request(method, path, reqData) {
    reqData = reqData || {};
    reqData.type = method;
    reqData.beforeSend = (xhr) => {
      xhr.setRequestHeader('Authorization', 'BEARER ' + this._token);
    };
    if (!reqData.dataType) reqData.dataType = 'json';
    if (!reqData.contentType) reqData.contentType = 'application/json';
    if (!reqData.url) reqData.url = this._root + path;
    return $.ajax(reqData).promise();
  }
_request ( method , path , reqData ) { reqData = reqData || { } ; reqData . type = method ; reqData . beforeSend = ( xhr ) => { xhr . setRequestHeader ( 'Authorization' , 'BEARER ' + this . _token ) ; } ; if ( ! reqData . dataType ) reqData . dataType = 'json' ; if ( ! reqData . contentType ) reqData . contentType = 'application/json' ; if ( ! reqData . url ) reqData . url = this . _root + path ; return $ . ajax ( reqData ) . promise ( ) ; }
_request makes an authenticated API request to DigitalOcean
_request makes an authenticated API request to DigitalOcean
// Set the HTTP verb for the req // Set the token authorization header // Set headders for sending and receiving JSON data // Build the url // Return a promise for the request