feat(frontend): simulate authenticated user sessions
This commit is contained in:
@@ -4,13 +4,8 @@ import "api_client.dart";
|
||||
class ResponsableService {
|
||||
ResponsableService._();
|
||||
|
||||
static const String _email = ApiClient.responsableEmail;
|
||||
|
||||
static Future<Map<String, dynamic>> dashboard() async {
|
||||
final reponse = await ApiClient.get(
|
||||
"/responsable/dashboard",
|
||||
utilisateurEmail: _email,
|
||||
);
|
||||
final reponse = await ApiClient.get("/responsable/dashboard");
|
||||
return Map<String, dynamic>.from(reponse["data"] as Map);
|
||||
}
|
||||
|
||||
@@ -32,14 +27,12 @@ class ResponsableService {
|
||||
static Future<ApiFile> exporterHistorique() => ApiClient.getFile(
|
||||
"/responsable/historique/export.csv",
|
||||
fallbackFileName: "historique-responsable.csv",
|
||||
utilisateurEmail: _email,
|
||||
);
|
||||
|
||||
static Future<int> marquerNotificationsLues() async {
|
||||
final reponse = await ApiClient.patch(
|
||||
"/responsable/notifications/lu-toutes",
|
||||
{},
|
||||
utilisateurEmail: _email,
|
||||
);
|
||||
final data = Map<String, dynamic>.from(reponse["data"] as Map);
|
||||
return data["count"] as int;
|
||||
@@ -52,12 +45,12 @@ class ResponsableService {
|
||||
final reponse = await ApiClient.patch("/responsable/anomalies/$id/statut", {
|
||||
"statut": statut,
|
||||
"observation": "Traitement depuis l'interface responsable",
|
||||
}, utilisateurEmail: _email);
|
||||
});
|
||||
return Map<String, dynamic>.from(reponse["data"] as Map);
|
||||
}
|
||||
|
||||
static Future<List<Map<String, dynamic>>> _liste(String chemin) async {
|
||||
final reponse = await ApiClient.get(chemin, utilisateurEmail: _email);
|
||||
final reponse = await ApiClient.get(chemin);
|
||||
final data = reponse["data"] as List;
|
||||
return data.map((item) => Map<String, dynamic>.from(item as Map)).toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user