disable join button on first click
parent
7a035c5a98
commit
a69f0f7318
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue