From 42cf5d28898ebce76f3681c4db32ea040016bbbb Mon Sep 17 00:00:00 2001 From: wuqifeng <540416539@qq.com> Date: Fri, 17 May 2024 14:39:48 +0800 Subject: [PATCH] feat:环节数据接口请求优化,解决token过期等失败情况死循环发起请求 --- lib/pages/section/bloc/section_bloc.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pages/section/bloc/section_bloc.dart b/lib/pages/section/bloc/section_bloc.dart index 698bf57..0c1d94c 100644 --- a/lib/pages/section/bloc/section_bloc.dart +++ b/lib/pages/section/bloc/section_bloc.dart @@ -67,9 +67,12 @@ class SectionBloc extends Bloc { RequestDataEvent event, Emitter emitter) async { try { await loading(() async { - _courseSectionDatasMap[event.courseUnitId] = - await LessonDao.courseSection(courseUnitId: event.courseUnitId); - emitter(LessonDataLoadState()); + List? courseSectionEntities = await LessonDao.courseSection(courseUnitId: event.courseUnitId); + if (courseSectionEntities != null) { + _courseSectionDatasMap[event.courseUnitId] = + await LessonDao.courseSection(courseUnitId: event.courseUnitId); + emitter(LessonDataLoadState()); + } }); } catch (e) { if (e is ApiException) { -- libgit2 0.22.2