Skip to content

Commit 84c4b58

Browse files
author
Sabina Gušić
committed
fix: add 'untagged' tag to bookmarks without tags on creation
1 parent 2165d94 commit 84c4b58

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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)