From be1c517a29be2ca80a6d824d1ca0656c73cde1d3 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sun, 28 Jul 2024 14:33:31 +0530 Subject: Discord activity: reduce code duplication --- priv/discord_activity.html.eex | 8 ++++++-- priv/static/discordActivity.js | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/priv/discord_activity.html.eex b/priv/discord_activity.html.eex index 9dd0649..5cb8a68 100644 --- a/priv/discord_activity.html.eex +++ b/priv/discord_activity.html.eex @@ -75,11 +75,15 @@ diff --git a/priv/static/discordActivity.js b/priv/static/discordActivity.js index 873bdde..f00ec1d 100644 --- a/priv/static/discordActivity.js +++ b/priv/static/discordActivity.js @@ -11,9 +11,7 @@ const updateInstanceRoomInfo = () => { contentEl.replaceChildren(defaultContents); } - fetch( - `/.proxy/discord_activity/rooms_for_instance?discord_activity_inner&instance_id=${discordSdk.instanceId}`, - ) + fetch(roomsForInstanceUrl(discordSdk.instanceId)) .then((response) => { if (!response.ok) { throw new Error(`Fetching instance room info failed with status code ${response.status}`); @@ -35,7 +33,7 @@ const updateInstanceRoomInfo = () => { form.style.display = "inline"; const hiddenInput = form.appendChild(document.createElement("input")); hiddenInput.type = "hidden"; - hiddenInput.name = "discord_activity_inner"; + hiddenInput.name = QUERY_PARAM_DISCORD_ACTIVITY_INNER; const submitInput = form.appendChild(document.createElement("input")); submitInput.type = "submit"; submitInput.value = "join"; -- cgit v1.2.3-57-g22cb