diff --git a/front/volume/src/components/Chat.svelte b/front/volume/src/components/Chat.svelte index 0b02be8..1ab7fb5 100644 --- a/front/volume/src/components/Chat.svelte +++ b/front/volume/src/components/Chat.svelte @@ -265,6 +265,23 @@ }; //--------------------------------------------------------------------------------/ + + const leaveChannel = async () => { + const prompt = window.prompt("Are you sure you want to leave this channel? (y/n)"); + if (prompt == "y") { + const response = await fetch(API_URL + "/channels/" + channel.id + "/leave", { + credentials: "include", + mode: "cors", + }); + if (response.ok) { + window.location.href = "/channels"; + } else { + alert("Failed to leave channel"); + } + } + } + + //--------------------------------------------------------------------------------/
@@ -333,6 +350,7 @@ send +