Skip to content

Commit 8fd47d0

Browse files
Sabina Gušićsgusic1
authored andcommitted
fix: add 'untagged' tag to bookmarks without tags on creation
1 parent 80813ce commit 8fd47d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

frontend/components/Bookmark/NewBookmarkCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,20 @@ export default function NewBookmarkCard() {
104104

105105
const handleOnSubmit = async (
106106
submittedBmk: NewBookmarkForm,
107-
actions: any,
107+
actions: any
108108
) => {
109109
// Get the last inputted string and all the tags already entered.
110110
let tags: Tag[] = strTags.map((t) => ({ title: t, id: -1 }));
111111
if (tagInput) {
112112
// FIXME
113113
tags.push({ title: tagInput, id: -1 });
114114
}
115+
116+
// Add default "untagged" tag if user has not provided any
117+
if (!tags.length) {
118+
tags = [{ title: "untagged", id: -1 }];
119+
}
120+
115121
let newBkmk: Bookmark = {
116122
id: -1,
117123
title: submittedBmk.title || submittedBmk.url,

0 commit comments

Comments
 (0)