added getChannelCounts service and refactored the client to more intelligently pull channel data

Этот коммит содержится в:
JoramWilander
2015-08-10 14:47:45 -04:00
родитель 1c0ee4d2f6
Коммит 6c0fefad15
10 изменённых файлов: 343 добавлений и 168 удалений

Просмотреть файл

@@ -540,19 +540,20 @@ module.exports.updateLastViewedAt = function(channelId, success, error) {
});
};
module.exports.getChannels = function(success, error) {
function getChannels(success, error) {
$.ajax({
url: "/api/v1/channels/",
url: '/api/v1/channels/',
dataType: 'json',
type: 'GET',
success: success,
ifModified: true,
error: function(xhr, status, err) {
e = handleError("getChannels", xhr, status, err);
var e = handleError('getChannels', xhr, status, err);
error(e);
}
});
};
}
module.exports.getChannels = getChannels;
module.exports.getChannel = function(id, success, error) {
$.ajax({
@@ -583,6 +584,21 @@ module.exports.getMoreChannels = function(success, error) {
});
};
function getChannelCounts(success, error) {
$.ajax({
url: '/api/v1/channels/counts',
dataType: 'json',
type: 'GET',
success: success,
ifModified: true,
error: function(xhr, status, err) {
var e = handleError('getChannelCounts', xhr, status, err);
error(e);
}
});
}
module.exports.getChannelCounts = getChannelCounts;
module.exports.getChannelExtraInfo = function(id, success, error) {
$.ajax({
url: "/api/v1/channels/" + id + "/extra_info",