Ignore:
Timestamp:
06/15/12 09:32:00 (12 years ago)
Author:
gustavo
Message:

Ticket #2766 - implementacao da dfd0065 e correcao de bugs da dfd0099

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.1-3/prototype/api/datalayer.js

    r6361 r6514  
    195195     
    196196    send: function( url, type, data, callback, sync, extraOptions ){ 
    197        
     197 
    198198          var result = false, fired = false; 
    199199       
     
    243243 
    244244          $.ajax( envelope ); 
    245        
    246245          return( result ); 
    247246    }, 
     
    260259        //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 
    261260        //return this.send( ('rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
     261console.log(this.dispatchPath+'../rest'+uri); 
    262262        return this.send( (this.dispatchPath + '../rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
    263263        {'beforeSend' : function (xhr){  
     
    277277     
    278278    create: function( uri, data, callback, accept ){ 
    279                 //return this.send( 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
    280                 return this.send( (this.dispatchPath + '../rest' + uri), [ 'post', accept || 'json' ], data, callback, !!!callback,  
    281                 {'beforeSend' : function (xhr){  
    282                         xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
    283                 });       
     279        //return this.send( 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
     280        return this.send( (this.dispatchPath + '../rest' + uri), [ 'post', accept || 'json' ], data, callback, !!!callback,  
     281        {'beforeSend' : function (xhr){  
     282                //xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     283                xhr.setRequestHeader('Authorization', "OAUTH Bearer " + (DataLayer.me ? DataLayer.me.token : DataLayer.dispatch("../prototype/me").token))}  
     284        });       
    284285    }, 
    285286 
     
    298299        return this.send( (this.dispatchPath + '../rest' + uri), [ 'put', accept || 'json' ], data, callback, !!!callback,  
    299300        {'beforeSend' : function (xhr){  
    300             xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     301            //xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     302                xhr.setRequestHeader('Authorization', "OAUTH Bearer " + (DataLayer.me ? DataLayer.me.token : DataLayer.dispatch("../prototype/me").token))}  
    301303        }); 
    302304       
     
    312314    */ 
    313315 
    314     "delete": function( uri, callback, accept ){ 
    315        
     316    delete: function( uri, callback, accept ){ 
    316317        //return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
    317318        return this.send( (this.dispatchPath + '../rest' + uri), [ 'delete', accept || 'json' ], false, callback, !!!callback,  
    318319        {'beforeSend' : function (xhr){  
    319             xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     320            //xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     321                xhr.setRequestHeader('Authorization', "OAUTH Bearer " + (DataLayer.me ? DataLayer.me.token : DataLayer.dispatch("../prototype/me").token))}  
    320322        }); 
    321323       
Note: See TracChangeset for help on using the changeset viewer.