diff --git a/client/src/components/Bookmarks/BookmarkForm/BookmarkForm.tsx b/client/src/components/Bookmarks/BookmarkForm/BookmarkForm.tsx index 4eb2937..c9506e9 100644 --- a/client/src/components/Bookmarks/BookmarkForm/BookmarkForm.tsx +++ b/client/src/components/Bookmarks/BookmarkForm/BookmarkForm.tsx @@ -42,8 +42,8 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => { }); const [bookmarkData, setBookmarkData] = useState({ - name: '', - url: '', + name: "", + url: "", categoryId: -1, icon: '', }); @@ -68,8 +68,8 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => { }); } else { setBookmarkData({ - name: '', - url: '', + name: "", + url: "", categoryId: -1, icon: '', }); @@ -113,7 +113,6 @@ const BookmarkForm = (props: ComponentProps): JSX.Element => { } else { props.addBookmark(bookmarkData); } - setBookmarkData({ name: "", url: "", diff --git a/client/src/components/Bookmarks/Bookmarks.tsx b/client/src/components/Bookmarks/Bookmarks.tsx index cd1b181..e8c23d0 100644 --- a/client/src/components/Bookmarks/Bookmarks.tsx +++ b/client/src/components/Bookmarks/Bookmarks.tsx @@ -50,10 +50,10 @@ const Bookmarks = (props: ComponentProps): JSX.Element => { updatedAt: new Date(), }); const [bookmarkInUpdate, setBookmarkInUpdate] = useState({ - name: "", - url: "", + name: "string", + url: "string", categoryId: -1, - icon: "", + icon: "string", isPinned: false, orderId: 0, id: 0, diff --git a/controllers/bookmark.js b/controllers/bookmark.js index 4445dbc..9fe6097 100644 --- a/controllers/bookmark.js +++ b/controllers/bookmark.js @@ -13,6 +13,12 @@ exports.createBookmark = asyncWrapper(async (req, res, next) => { }); let bookmark; + let _body = { ...req.body }; + + if (req.file) { + _body.icon = req.file.filename; + } + let _body = { ...req.body,