Update Saqel Platform: 2026-09-08 13:43:36
This commit is contained in:
@@ -56,6 +56,10 @@ class TeacherAuthCubit extends Cubit<TeacherAuthState> {
|
||||
}
|
||||
}
|
||||
|
||||
void resetToPhone() {
|
||||
emit(TeacherUnauthenticated());
|
||||
}
|
||||
|
||||
Future<void> sendOtp(String phoneNumber) async {
|
||||
emit(TeacherAuthLoading());
|
||||
try {
|
||||
@@ -70,11 +74,29 @@ class TeacherAuthCubit extends Cubit<TeacherAuthState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> verifyOtp(String phoneNumber, String otp, {String? fullName}) async {
|
||||
Future<void> verifyOtp(
|
||||
String phoneNumber,
|
||||
String otp, {
|
||||
String? fullName,
|
||||
String? specialization,
|
||||
String? schoolName,
|
||||
List<String>? gradesTaught,
|
||||
}) async {
|
||||
emit(TeacherAuthLoading());
|
||||
try {
|
||||
final res = await repository.verifyOtp(phoneNumber, otp, fullName: fullName);
|
||||
if (res['status'] == 'success') {
|
||||
if (specialization != null || schoolName != null || gradesTaught != null) {
|
||||
try {
|
||||
await repository.setupProfile(
|
||||
fullName: fullName ?? 'المعلم المعتمد',
|
||||
specialization: specialization ?? 'الفيزياء والعلوم التطبيقية',
|
||||
schoolName: schoolName ?? 'مدرسة الملك عبد الله الثاني للتميز',
|
||||
gradesTaught: gradesTaught ?? ['الصف العاشر الأساسي'],
|
||||
bio: 'معلم معتمد في منصة صقل للتعليم التفاعلي',
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
final profile = await repository.getProfileStatus();
|
||||
emit(TeacherAuthenticated(profile: profile));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user