From d99610115269885a57bb64fd1c3b1b9cf192d5bd Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 3 Jun 2020 13:01:28 -0700 Subject: [PATCH] Move function set_automark to api.js. --- frontends/ycdl_flask/static/js/api.js | 9 +++++++++ frontends/ycdl_flask/templates/channel.html | 5 +---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontends/ycdl_flask/static/js/api.js b/frontends/ycdl_flask/static/js/api.js index b343b76..a60f5ef 100644 --- a/frontends/ycdl_flask/static/js/api.js +++ b/frontends/ycdl_flask/static/js/api.js @@ -30,5 +30,14 @@ function refresh_all_channels(force, callback) return common.post(url, data, callback); } +api.channels.set_automark = +function set_automark(channel_id, state, callback) +{ + var url = `/channel/${channel_id}/set_automark`; + data = new FormData(); + data.append("state", state); + return common.post(url, data, callback); +} + /**************************************************************************************************/ api.videos = {}; diff --git a/frontends/ycdl_flask/templates/channel.html b/frontends/ycdl_flask/templates/channel.html index 0057c60..205ead8 100644 --- a/frontends/ycdl_flask/templates/channel.html +++ b/frontends/ycdl_flask/templates/channel.html @@ -481,10 +481,7 @@ function receive_action_response(response) function set_automark_hook(event) { - var url = "/channel/{{channel.id}}/set_automark"; - data = new FormData(); - data.append("state", event.target.value); - return common.post(url, data); + api.channels.set_automark(CHANNEL_ID, event.target.value); } function mark_video_state(video_ids, state, callback)