disable join button on first click

pull/6/head
maia arson crimew 2021-12-03 20:37:16 +01:00
parent 7a035c5a98
commit a69f0f7318
3 changed files with 11 additions and 10 deletions

View File

@ -36,7 +36,7 @@
placeholder="123e4567-e89b-12d3-a456-426614174000"
required
/>
<button>Join</button>
<button id="join-session-button">Join</button>
</form>
<p>
@ -52,6 +52,6 @@
</form>
</div>
<script type="module" src="/main.mjs?v=3"></script>
<script type="module" src="/main.mjs?v=4"></script>
</body>
</html>

View File

@ -37,6 +37,7 @@ export const setupJoinSessionForm = () => {
const form = document.querySelector("#join-session-form");
const nickname = form.querySelector("#join-session-nickname");
const sessionId = form.querySelector("#join-session-id");
const button = form.querySelector("#join-session-button");
loadNickname(nickname);
@ -44,11 +45,11 @@ export const setupJoinSessionForm = () => {
sessionId.value = window.location.hash.substring(1);
}
document
.querySelector("#join-session-form")
.addEventListener("submit", (event) => {
form.addEventListener("submit", (event) => {
event.preventDefault();
button.disabled = true;
saveNickname(nickname);
joinSession(nickname.value, sessionId.value);
});

View File

@ -1,4 +1,4 @@
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=3";
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=4";
const main = () => {
setupJoinSessionForm();