Spaces:
Running
Running
Upload 9 files
Browse files- src/views/InstructorView.js +14 -0
src/views/InstructorView.js
CHANGED
|
@@ -175,6 +175,20 @@ export function setupInstructorEvents() {
|
|
| 175 |
const pwdInput = document.getElementById('instructor-password');
|
| 176 |
const authModal = document.getElementById('auth-modal');
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
// Default password check
|
| 179 |
const checkPassword = async () => {
|
| 180 |
const { verifyInstructorPassword } = await import("../services/classroom.js");
|
|
|
|
| 175 |
const pwdInput = document.getElementById('instructor-password');
|
| 176 |
const authModal = document.getElementById('auth-modal');
|
| 177 |
|
| 178 |
+
// Define Kick Function globally (robust against auth flow)
|
| 179 |
+
window.confirmKick = async (userId, nickname) => {
|
| 180 |
+
if (confirm(`確定要踢出 ${nickname} 嗎?此動作無法復原。`)) {
|
| 181 |
+
try {
|
| 182 |
+
const { removeUser } = await import("../services/classroom.js");
|
| 183 |
+
await removeUser(userId);
|
| 184 |
+
// UI will update automatically via subscribeToRoom
|
| 185 |
+
} catch (e) {
|
| 186 |
+
console.error("Kick failed:", e);
|
| 187 |
+
alert("移除失敗");
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
};
|
| 191 |
+
|
| 192 |
// Default password check
|
| 193 |
const checkPassword = async () => {
|
| 194 |
const { verifyInstructorPassword } = await import("../services/classroom.js");
|