Browse Source

leavechannel

master
WalidMoovin 2 years ago
parent
commit
7896375898
  1. 18
      front/volume/src/components/Chat.svelte

18
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");
}
}
}
//--------------------------------------------------------------------------------/
</script>
<div class="overlay">
@ -333,6 +350,7 @@
<img src="img/send.png" alt="send" />
</button>
</form>
<button on:click={leaveChannel}>Leave</button>
<button
on:click|stopPropagation={toggleChatMembers}
on:keydown|stopPropagation

Loading…
Cancel
Save