fix: load course images on course load

This commit is contained in:
ggurdin 2025-12-15 11:35:37 -05:00
parent 72c1a87cf2
commit 4dc9a9d98f
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
2 changed files with 3 additions and 6 deletions

View file

@ -46,6 +46,7 @@ mixin CoursePlanProvider<T extends StatefulWidget> on State<T> {
l1: MatrixState.pangeaController.userController.userL1Code!,
),
);
await course!.fetchMediaUrls();
} catch (e) {
courseError = e;
} finally {
@ -64,11 +65,7 @@ mixin CoursePlanProvider<T extends StatefulWidget> on State<T> {
throw Exception("Course is null");
}
final courseFutures = <Future>[
course!.fetchMediaUrls(),
course!.fetchTopics(),
];
await Future.wait(courseFutures);
await course!.fetchTopics();
await _loadTopicsMedia();
} catch (e) {
topicError = e;

View file

@ -131,5 +131,5 @@ class CoursePlanModel {
? loadedTopics.values
.lastWhereOrNull((topic) => topic.imageUrl != null)
?.imageUrl
: "${Environment.cmsApi}${loadedMediaUrls.mediaUrls.first}";
: "${Environment.cmsApi}${loadedMediaUrls.mediaUrls.first.url}";
}