FIX: never cache ajax GET requests unless specified

This commit is contained in:
Sam 2014-08-06 16:16:29 +10:00
parent bbcb6ba3f1
commit ce942fe324
1 changed files with 5 additions and 1 deletions

View File

@ -72,6 +72,10 @@ Discourse.Ajax = Em.Mixin.create({
if (!args.type) args.type = 'GET';
if (!args.dataType && args.type.toUpperCase() === 'GET') args.dataType = 'json';
if (args.type === 'GET' && args.cache !== true) {
args.cache = false;
}
$.ajax(Discourse.getURL(url), args);
};
@ -79,7 +83,7 @@ Discourse.Ajax = Em.Mixin.create({
// request (bypass for GET, not needed)
if(args.type && args.type.toUpperCase() !== 'GET' && !Discourse.Session.currentProp('csrfToken')){
return Ember.Deferred.promise(function(promise){
$.ajax(Discourse.getURL('/session/csrf'))
$.ajax(Discourse.getURL('/session/csrf'), {cache: false})
.success(function(result){
Discourse.Session.currentProp('csrfToken', result.csrf);
performAjax(promise);