Move function add_channel to api.js.

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

View file

@ -3,6 +3,15 @@ var api = {};
/**************************************************************************************************/
api.channels = {};
api.channels.add_channel =
function add_channel(channel_id, callback)
{
var url = "/add_channel";
data = new FormData();
data.append("channel_id", channel_id);
return common.post(url, data, callback);
}
api.channels.refresh_channel =
function refresh_channel(channel_id, force, callback)
{

View file

@ -80,7 +80,7 @@ function add_channel_form(event)
{
if (box.value !== "")
{
add_channel(box.value, add_channel_callback);
api.channels.add_channel(box.value, add_channel_callback);
}
}
@ -91,13 +91,5 @@ function add_channel_callback(response)
window.location.href = "/channel/" + response["data"]["id"];
}
}
function add_channel(channel_id, callback)
{
var url = "/add_channel";
data = new FormData();
data.append("channel_id", channel_id);
return common.post(url, data, callback);
}
</script>
</html>