Commit 42cf5d28898ebce76f3681c4db32ea040016bbbb

Authored by 吴启风
1 parent 9e085b2a

feat:环节数据接口请求优化,解决token过期等失败情况死循环发起请求

lib/pages/section/bloc/section_bloc.dart
... ... @@ -67,9 +67,12 @@ class SectionBloc extends Bloc<SectionEvent, SectionState> {
67 67 RequestDataEvent event, Emitter<SectionState> emitter) async {
68 68 try {
69 69 await loading(() async {
70   - _courseSectionDatasMap[event.courseUnitId] =
71   - await LessonDao.courseSection(courseUnitId: event.courseUnitId);
72   - emitter(LessonDataLoadState());
  70 + List<CourseSectionEntity>? courseSectionEntities = await LessonDao.courseSection(courseUnitId: event.courseUnitId);
  71 + if (courseSectionEntities != null) {
  72 + _courseSectionDatasMap[event.courseUnitId] =
  73 + await LessonDao.courseSection(courseUnitId: event.courseUnitId);
  74 + emitter(LessonDataLoadState());
  75 + }
73 76 });
74 77 } catch (e) {
75 78 if (e is ApiException) {
... ...