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)