mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Start to build join group pane
This commit is contained in:
17
lib/helpers/forez_groups_helper.dart
Normal file
17
lib/helpers/forez_groups_helper.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:comunic/helpers/groups_helper.dart';
|
||||
import 'package:comunic/models/api_request.dart';
|
||||
import 'package:comunic/models/group.dart';
|
||||
|
||||
/// Forez groups helper
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class ForezGroupsHelper {
|
||||
static Future<List<Group>> getForezGroups() async {
|
||||
return (await APIRequest.withLogin("forez/get_groups").execWithThrow())
|
||||
.getArray()
|
||||
.cast<Map<String, dynamic>>()
|
||||
.map(GroupsHelper.getGroupFromAPI)
|
||||
.toList();
|
||||
}
|
||||
}
|
@ -70,7 +70,7 @@ class GroupsHelper {
|
||||
|
||||
response
|
||||
.getObject()
|
||||
.forEach((k, d) => list[int.parse(k)] = _getGroupFromAPI(d));
|
||||
.forEach((k, d) => list[int.parse(k)] = getGroupFromAPI(d));
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -370,7 +370,7 @@ class GroupsHelper {
|
||||
.execWithThrow();
|
||||
|
||||
/// Turn an API entry into a group object
|
||||
Group _getGroupFromAPI(Map<String, dynamic> map) {
|
||||
static Group getGroupFromAPI(Map<String, dynamic> map) {
|
||||
return Group(
|
||||
id: map["id"],
|
||||
name: map["name"],
|
||||
|
Reference in New Issue
Block a user