You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
693 B
JavaScript
30 lines
693 B
JavaScript
11 years ago
|
var categories = require('../categories'),
|
||
|
|
||
|
SocketCategories = {};
|
||
|
|
||
|
SocketCategories.getRecentReplies = function(tid, callback, sessionData) {
|
||
|
categories.getRecentReplies(tid, sessionData.uid, 4, function(err, replies) {
|
||
|
callback(replies);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
SocketCategories.get = function(callback) {
|
||
|
categories.getAllCategories(0, function(err, categories) {
|
||
|
if(callback) {
|
||
|
callback(categories);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
SocketCategories.loadMore = function(data, callback, sessionData) {
|
||
|
var start = data.after,
|
||
|
end = start + 9;
|
||
|
|
||
|
categories.getCategoryTopics(data.cid, start, end, sessionData.uid, function(topics) {
|
||
|
callback({
|
||
|
topics: topics
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = SocketCategories;
|