mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 13:25:40 +00:00 
			
		
		
		
	Update API for marking a notification as "read" (#228)
This commit is contained in:
		| @@ -42,10 +42,12 @@ class InvenTreeNotification extends InvenTreeModel { | |||||||
|    */ |    */ | ||||||
|   Future<void> dismiss() async { |   Future<void> dismiss() async { | ||||||
|  |  | ||||||
|     await api.post( |     if (api.apiVersion >= 82) { | ||||||
|       "${url}read/", |       // "Modern" API endpoint operates a little differently | ||||||
|     ); |       await update(values: {"read": "true"}); | ||||||
|  |     } else { | ||||||
|  |       await api.post("${url}read/"); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -43,6 +43,9 @@ class _NotificationState extends RefreshableState<NotificationWidget> { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   /* | ||||||
|  |    * Dismiss an individual notification entry (mark it as "read") | ||||||
|  |    */ | ||||||
|   Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async { |   Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async { | ||||||
|  |  | ||||||
|     await notification.dismiss(); |     await notification.dismiss(); | ||||||
| @@ -51,6 +54,9 @@ class _NotificationState extends RefreshableState<NotificationWidget> { | |||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   /* | ||||||
|  |    * Display an individual notification message | ||||||
|  |    */ | ||||||
|   List<Widget> renderNotifications(BuildContext context) { |   List<Widget> renderNotifications(BuildContext context) { | ||||||
|  |  | ||||||
|     List<Widget> tiles = []; |     List<Widget> tiles = []; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user