Spaces:
Running
Running
Upload 9 files
Browse files- src/main.js +6 -0
- src/views/InstructorView.js +1 -0
src/main.js
CHANGED
|
@@ -58,6 +58,12 @@ function handleRoute() {
|
|
| 58 |
}
|
| 59 |
|
| 60 |
// Auto-login check
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 62 |
const userId = localStorage.getItem('vibecoding_user_id'); // Changed key to match new logic
|
| 63 |
|
|
|
|
| 58 |
}
|
| 59 |
|
| 60 |
// Auto-login check
|
| 61 |
+
if (localStorage.getItem('vibecoding_redirect_login') === 'true') {
|
| 62 |
+
localStorage.removeItem('vibecoding_redirect_login'); // Clear flag
|
| 63 |
+
navigateTo('instructor');
|
| 64 |
+
return;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 68 |
const userId = localStorage.getItem('vibecoding_user_id'); // Changed key to match new logic
|
| 69 |
|
src/views/InstructorView.js
CHANGED
|
@@ -403,6 +403,7 @@ export function setupInstructorEvents() {
|
|
| 403 |
const retryBtn = document.getElementById('redirect-login-btn');
|
| 404 |
if (retryBtn) {
|
| 405 |
retryBtn.addEventListener('click', () => {
|
|
|
|
| 406 |
signInWithGoogleRedirect().catch(e => alert("跳轉失敗: " + e.message));
|
| 407 |
});
|
| 408 |
}
|
|
|
|
| 403 |
const retryBtn = document.getElementById('redirect-login-btn');
|
| 404 |
if (retryBtn) {
|
| 405 |
retryBtn.addEventListener('click', () => {
|
| 406 |
+
localStorage.setItem('vibecoding_redirect_login', 'true'); // Flag for main.js
|
| 407 |
signInWithGoogleRedirect().catch(e => alert("跳轉失敗: " + e.message));
|
| 408 |
});
|
| 409 |
}
|