mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Converted a bunch of ajax calls to use promises
This commit is contained in:
@@ -19,14 +19,13 @@ Discourse.AdminDashboard.reopenClass({
|
||||
@return {jqXHR} a jQuery Promise object
|
||||
**/
|
||||
find: function() {
|
||||
var model = Discourse.AdminDashboard.create();
|
||||
return Discourse.ajax(Discourse.getURL("/admin/dashboard"), {
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
model.mergeAttributes(json);
|
||||
model.set('loaded', true);
|
||||
}
|
||||
dataType: 'json'
|
||||
}).then(function(json) {
|
||||
var model = Discourse.AdminDashboard.create(json);
|
||||
model.set('loaded', true);
|
||||
return model;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -38,14 +37,13 @@ Discourse.AdminDashboard.reopenClass({
|
||||
@return {jqXHR} a jQuery Promise object
|
||||
**/
|
||||
fetchProblems: function() {
|
||||
var model = Discourse.AdminDashboard.create();
|
||||
return Discourse.ajax(Discourse.getURL("/admin/dashboard/problems"), {
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
model.mergeAttributes(json);
|
||||
model.set('loaded', true);
|
||||
}
|
||||
dataType: 'json'
|
||||
}).then(function(json) {
|
||||
var model = Discourse.AdminDashboard.create(json);
|
||||
model.set('loaded', true);
|
||||
return model;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user