JusTalk / static /login.js
buletomato25
pull0323
96e3aa5
raw
history blame
1.3 kB
let mediaRecorder;
let audioChunks = [];
let userCount = 0; // 追加されたメンバー数を保持
let isRecording = false; // 録音中かどうかを判定するフラグ
let currentRecordingButton = null; // 現在録音中のボタンを保持
let userNames = [];
document.getElementById("login-btn").addEventListener("click", function () {
const nameInput = document.querySelector('#people-list input[name="name"]');
const name = nameInput ? nameInput.value.trim() : "";
if (!name) {
alert("名前を入力してください");
return;
}
fetch("/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ name: name }),
})
.then((response) => response.json())
.then((data) => {
if (data.error) {
alert("エラー: " + data.error);
console.error(data.details);
} else {
console.log("ログイン成功:", data);
// ここでUIの更新や次のアクションを追加できます
}
})
.catch((error) => {
console.error("通信エラー:", error);
alert("ログイン中にエラーが発生しました");
});
});
function Register() {
window.location.href = "userregister";
}