Move function refresh_channel to api.js.

This commit is contained in:
voussoir 2020-06-03 12:59:29 -07:00
parent b76be18b6c
commit ab1a2364be
2 changed files with 11 additions and 10 deletions

View file

@ -3,5 +3,14 @@ var api = {};
/**************************************************************************************************/ /**************************************************************************************************/
api.channels = {}; api.channels = {};
api.channels.refresh_channel =
function refresh_channel(channel_id, force, callback)
{
var url = `/channel/${channel_id}/refresh`;
data = new FormData();
data.append("force", force)
return common.post(url, data, callback);
}
/**************************************************************************************************/ /**************************************************************************************************/
api.videos = {}; api.videos = {};

View file

@ -155,8 +155,8 @@ https://stackoverflow.com/a/35153397
{{header.make_header()}} {{header.make_header()}}
<div id="content_body"> <div id="content_body">
{% if channel is not none %} {% if channel is not none %}
<span><button class="refresh_button" onclick="refresh_channel('{{channel.id}}', false, common.refresh)">Refresh new videos</button></span> <span><button class="refresh_button" onclick="api.channels.refresh_channel(CHANNEL_ID, false, common.refresh)">Refresh new videos</button></span>
<span><button class="refresh_button" onclick="refresh_channel('{{channel.id}}', true, common.refresh)">Refresh everything</button></span> <span><button class="refresh_button" onclick="api.channels.refresh_channel(CHANNEL_ID, true, common.refresh)">Refresh everything</button></span>
<span><a class="merge_params" href="/channel/{{channel.id}}">All</a></span> <span><a class="merge_params" href="/channel/{{channel.id}}">All</a></span>
{% else %} {% else %}
@ -479,14 +479,6 @@ function receive_action_response(response)
} }
} }
function refresh_channel(channel_id, force, callback)
{
var url = `/channel/${channel_id}/refresh`;
data = new FormData();
data.append("force", force)
return common.post(url, data, callback);
}
function set_automark_hook(event) function set_automark_hook(event)
{ {
var url = "/channel/{{channel.id}}/set_automark"; var url = "/channel/{{channel.id}}/set_automark";