From 826ca58f85d34ce22c1f8f0bac29374b5d152a96 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Sun, 25 Feb 2024 03:18:31 +0100 Subject: [PATCH] Fix add bookmark with no tags --- lib/models/data/post_bookmark.dart | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/models/data/post_bookmark.dart b/lib/models/data/post_bookmark.dart index b285c7e..1d9a323 100644 --- a/lib/models/data/post_bookmark.dart +++ b/lib/models/data/post_bookmark.dart @@ -17,13 +17,21 @@ class PostBookmark { required this.tagNames, }); - Map toJson() => { - "url": url, - "title": title, - "description": description, - "is_archived": isArchived, - "unread": unread, - "shared": shared, + Map toJson() { + Map ret = { + "url": url, + "title": title, + "description": description, + "is_archived": isArchived, + "unread": unread, + "shared": shared, + }; + if (tagNames != "") { + ret = { + ...ret, "tag_names": tagNames, }; + } + return ret; + } }