Ignore:
Timestamp:
05/31/12 14:46:42 (12 years ago)
Author:
gustavo
Message:

Ticket #2768 - Melhorias na criação de mensagens

File:
1 edited

Legend:

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

    r6351 r6361  
    259259        //return this.send( this.dispatchPath + 'rest' + uri, [ 'get', accept || 'json' ], false, callback ); 
    260260        //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 
    261         return this.send( ('rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
     261        //return this.send( ('rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
     262        return this.send( (this.dispatchPath + '../rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
    262263        {'beforeSend' : function (xhr){  
    263             xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     264            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + (DataLayer.me ? DataLayer.me.token : DataLayer.dispatch("../prototype/me").token))}  
    264265        }); 
    265266       
     
    276277     
    277278    create: function( uri, data, callback, accept ){ 
    278        
    279         return this.send( 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
    280         {'beforeSend' : function (xhr){  
    281             xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
    282         }); 
    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                });       
    284284    }, 
    285285 
     
    295295    update: function( uri, data, callback, accept ){ 
    296296       
    297         return this.send( 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback,  
     297        //return this.send( 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback,  
     298        return this.send( (this.dispatchPath + '../rest' + uri), [ 'put', accept || 'json' ], data, callback, !!!callback,  
    298299        {'beforeSend' : function (xhr){  
    299300            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     
    313314    "delete": function( uri, callback, accept ){ 
    314315       
    315         return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
     316        //return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
     317        return this.send( (this.dispatchPath + '../rest' + uri), [ 'delete', accept || 'json' ], false, callback, !!!callback,  
    316318        {'beforeSend' : function (xhr){  
    317319            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
Note: See TracChangeset for help on using the changeset viewer.