get notification sevice
This commit is contained in:
parent
f04f4f57d2
commit
32eb24ddf5
2 changed files with 22 additions and 35 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/notification.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
|
|
@ -11,6 +12,23 @@ class MihNotificationApis {
|
|||
final baseAPI = AppEnviroment.baseApiUrl;
|
||||
//================== Notifications ==========================================================================
|
||||
|
||||
Future<List<MIHNotification>> getNotificationByUser(
|
||||
String app_id,
|
||||
int notificationAmount,
|
||||
) async {
|
||||
var responseNotification = await http.get(
|
||||
Uri.parse("$baseAPI/notifications/$app_id?amount=$notificationAmount"));
|
||||
if (responseNotification.statusCode == 200) {
|
||||
String body = responseNotification.body;
|
||||
Iterable l = jsonDecode(body);
|
||||
List<MIHNotification> notifications = List<MIHNotification>.from(
|
||||
l.map((model) => MIHNotification.fromJson(model)));
|
||||
return notifications;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/// This function is used to create notification to patient for access reviews
|
||||
///
|
||||
/// Patameters:-
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue