Commit 42cf5d28898ebce76f3681c4db32ea040016bbbb
1 parent
9e085b2a
feat:环节数据接口请求优化,解决token过期等失败情况死循环发起请求
Showing
1 changed file
with
6 additions
and
3 deletions
lib/pages/section/bloc/section_bloc.dart
@@ -67,9 +67,12 @@ class SectionBloc extends Bloc<SectionEvent, SectionState> { | @@ -67,9 +67,12 @@ class SectionBloc extends Bloc<SectionEvent, SectionState> { | ||
67 | RequestDataEvent event, Emitter<SectionState> emitter) async { | 67 | RequestDataEvent event, Emitter<SectionState> emitter) async { |
68 | try { | 68 | try { |
69 | await loading(() async { | 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 | } catch (e) { | 77 | } catch (e) { |
75 | if (e is ApiException) { | 78 | if (e is ApiException) { |