history feature

This commit is contained in:
wgh19
2024-05-15 12:49:58 +08:00
parent 51bff418c7
commit e59d15f685
3 changed files with 76 additions and 0 deletions

View File

@@ -418,4 +418,18 @@ class Network {
return Res.error(res.errorMessage);
}
}
Future<Res<List<Illust>>> getHistory(int page) async {
String param = "";
if(page > 1) {
param = "?offset=${30*(page-1)}";
}
var res = await apiGet("/v1/user/browsing-history/illusts$param");
if (res.success) {
return Res((res.data["illusts"] as List)
.map((e) => Illust.fromJson(e)).toList());
} else {
return Res.error(res.errorMessage);
}
}
}