mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
added callback to api categories.get
This commit is contained in:
@@ -102,7 +102,7 @@ define(function() {
|
|||||||
|
|
||||||
var loadingEl = document.getElementById('categories-loading');
|
var loadingEl = document.getElementById('categories-loading');
|
||||||
if (loadingEl) {
|
if (loadingEl) {
|
||||||
socket.once('api:categories.get', function(data) {
|
socket.emit('api:categories.get', function(data) {
|
||||||
// Render categories
|
// Render categories
|
||||||
var categoriesFrag = document.createDocumentFragment(),
|
var categoriesFrag = document.createDocumentFragment(),
|
||||||
categoryEl = document.createElement('li'),
|
categoryEl = document.createElement('li'),
|
||||||
@@ -172,7 +172,6 @@ define(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
socket.emit('api:categories.get');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -591,9 +591,9 @@ websockets.init = function(io) {
|
|||||||
threadTools.move(data.tid, data.cid, socket);
|
threadTools.move(data.tid, data.cid, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:categories.get', function() {
|
socket.on('api:categories.get', function(callback) {
|
||||||
categories.getAllCategories(0, function(err, categories) {
|
categories.getAllCategories(0, function(err, categories) {
|
||||||
socket.emit('api:categories.get', categories);
|
callback(categories);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user