mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Adds ability to "dismiss" a notification
This commit is contained in:
parent
6bbae67482
commit
020f006410
3 changed files with 33 additions and 3 deletions
|
|
@ -18,6 +18,15 @@ class InvenTreeNotification extends InvenTreeModel {
|
|||
@override
|
||||
String get URL => "notifications/";
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
|
||||
// By default, only return 'unread' notifications
|
||||
return {
|
||||
"read": "false",
|
||||
};
|
||||
}
|
||||
|
||||
String get message => (jsondata["message"] ?? "") as String;
|
||||
|
||||
DateTime? get creationDate {
|
||||
|
|
@ -28,4 +37,15 @@ class InvenTreeNotification extends InvenTreeModel {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Dismiss this notification (mark as read)
|
||||
*/
|
||||
Future<void> dismiss() async {
|
||||
|
||||
final response = await api.post(
|
||||
"${url}read/",
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue