Changeset 6514 for sandbox/2.4.1-3/prototype/api/datalayer.js
- Timestamp:
- 06/15/12 09:32:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.1-3/prototype/api/datalayer.js
r6361 r6514 195 195 196 196 send: function( url, type, data, callback, sync, extraOptions ){ 197 197 198 198 var result = false, fired = false; 199 199 … … 243 243 244 244 $.ajax( envelope ); 245 246 245 return( result ); 247 246 }, … … 260 259 //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 261 260 //return this.send( ('rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback, 261 console.log(this.dispatchPath+'../rest'+uri); 262 262 return this.send( (this.dispatchPath + '../rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback, 263 263 {'beforeSend' : function (xhr){ … … 277 277 278 278 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 }); 284 285 }, 285 286 … … 298 299 return this.send( (this.dispatchPath + '../rest' + uri), [ 'put', accept || 'json' ], data, callback, !!!callback, 299 300 {'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))} 301 303 }); 302 304 … … 312 314 */ 313 315 314 "delete": function( uri, callback, accept ){ 315 316 delete: function( uri, callback, accept ){ 316 317 //return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback, 317 318 return this.send( (this.dispatchPath + '../rest' + uri), [ 'delete', accept || 'json' ], false, callback, !!!callback, 318 319 {'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))} 320 322 }); 321 323
Note: See TracChangeset
for help on using the changeset viewer.