Fix Redis session mismatch in AuthMiddleware and ensure instant Onboarding UI transition

This commit is contained in:
Hamza-Ayed
2026-08-26 23:46:48 +03:00
parent cdb08331c0
commit fe66f05057
3 changed files with 46 additions and 21 deletions
+11 -1
View File
@@ -955,7 +955,17 @@ class TeacherPortal
if (res.ok && data.status === 'success' && data.data?.token) {
const token = data.data.token;
localStorage.setItem('saqel_teacher_jwt', token);
await checkTeacherSession(token);
const user = data.data.user;
// Immediate UI Transition
if (user && user.name && user.name !== 'معلم جديد' && user.name !== 'مستخدم صَقِل') {
renderDashboard(user);
} else {
switchToOnboardingStep(user?.name || '');
}
// Sync profile status in background
checkTeacherSession(token);
} else {
showError(data.message || 'رمز التحقق غير صحيح');
}