forked from lavender/watch-party
disable join button on first click
parent
7a035c5a98
commit
a69f0f7318
|
@ -36,7 +36,7 @@
|
||||||
placeholder="123e4567-e89b-12d3-a456-426614174000"
|
placeholder="123e4567-e89b-12d3-a456-426614174000"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<button>Join</button>
|
<button id="join-session-button">Join</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -52,6 +52,6 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="/main.mjs?v=3"></script>
|
<script type="module" src="/main.mjs?v=4"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -37,6 +37,7 @@ export const setupJoinSessionForm = () => {
|
||||||
const form = document.querySelector("#join-session-form");
|
const form = document.querySelector("#join-session-form");
|
||||||
const nickname = form.querySelector("#join-session-nickname");
|
const nickname = form.querySelector("#join-session-nickname");
|
||||||
const sessionId = form.querySelector("#join-session-id");
|
const sessionId = form.querySelector("#join-session-id");
|
||||||
|
const button = form.querySelector("#join-session-button");
|
||||||
|
|
||||||
loadNickname(nickname);
|
loadNickname(nickname);
|
||||||
|
|
||||||
|
@ -44,12 +45,12 @@ export const setupJoinSessionForm = () => {
|
||||||
sessionId.value = window.location.hash.substring(1);
|
sessionId.value = window.location.hash.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
document
|
form.addEventListener("submit", (event) => {
|
||||||
.querySelector("#join-session-form")
|
event.preventDefault();
|
||||||
.addEventListener("submit", (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
saveNickname(nickname);
|
button.disabled = true;
|
||||||
joinSession(nickname.value, sessionId.value);
|
|
||||||
});
|
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 = () => {
|
const main = () => {
|
||||||
setupJoinSessionForm();
|
setupJoinSessionForm();
|
||||||
|
|
Loading…
Reference in New Issue