Skip to content

Commit

Permalink
feat: create timer after success
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Nov 10, 2024
1 parent aaa006a commit 7056181
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ui/lib/providers/activity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ class ActivityData
extends AutoDisposeFamilyAsyncNotifier<List<Activity>, String> {
@override
FutureOr<List<Activity>> build(String arg) async {
if (arg == "active") {
//refresh active downloads
Timer(const Duration(seconds: 5),
ref.invalidateSelf); //Periodically Refresh
}

final dio = await APIs.getDio();
var resp =
await dio.get(APIs.activityUrl, queryParameters: {"status": arg});
Expand All @@ -44,6 +38,12 @@ class ActivityData
for (final a in sp.data as List) {
activities.add(Activity.fromJson(a));
}

if (arg == "active") {
//refresh active downloads
Timer(const Duration(seconds: 5),
() => ref.invalidateSelf()); //Periodically Refresh
}
return activities;
}

Expand Down

0 comments on commit 7056181

Please sign in to comment.