Move function refresh_all_channels to api.js.

This commit is contained in:
voussoir 2020-06-03 13:00:16 -07:00
parent ab1a2364be
commit 1f2c43278a
2 changed files with 11 additions and 10 deletions

View file

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

View file

@ -49,8 +49,8 @@
<body> <body>
{{header.make_header()}} {{header.make_header()}}
<div id="content_body"> <div id="content_body">
<span><button class="refresh_button" onclick="refresh_all_channels(false, common.refresh)">Refresh new videos</button></span> <span><button class="refresh_button" onclick="api.channels.refresh_all_channels(false, common.refresh)">Refresh new videos</button></span>
<span><button class="refresh_button" onclick="refresh_all_channels(true, common.refresh)">Refresh everything</button></span> <span><button class="refresh_button" onclick="api.channels.refresh_all_channels(true, common.refresh)">Refresh everything</button></span>
<div> <div>
<input type="text" id="new_channel_textbox"> <input type="text" id="new_channel_textbox">
<button id="new_channel_button" onclick="add_channel_form(event)">Add new channel</button> <button id="new_channel_button" onclick="add_channel_form(event)">Add new channel</button>
@ -99,13 +99,5 @@ function add_channel(channel_id, callback)
data.append("channel_id", channel_id); data.append("channel_id", channel_id);
return common.post(url, data, callback); return common.post(url, data, callback);
} }
function refresh_all_channels(force, callback)
{
var url = "/refresh_all_channels";
data = new FormData();
data.append("force", force)
return common.post(url, data, callback);
}
</script> </script>
</html> </html>