mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
FIX: never cache ajax GET requests unless specified
This commit is contained in:
parent
bbcb6ba3f1
commit
ce942fe324
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user