diff options
| author | MohamedBassem <me@mbassem.com> | 2024-10-13 12:22:33 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-10-13 12:22:33 +0000 |
| commit | 43ed698930531631116f0fc22234a9ef68c122e6 (patch) | |
| tree | 2010f230e2bcb4112c99e3c1853eb607d48fe2d1 /apps/web/components/dashboard | |
| parent | cdd0088a7f1d1978b6fa84c7bd2ab12636214227 (diff) | |
| download | karakeep-43ed698930531631116f0fc22234a9ef68c122e6.tar.zst | |
fix: Add support for importing notes from the hoarder export
Diffstat (limited to 'apps/web/components/dashboard')
| -rw-r--r-- | apps/web/components/dashboard/settings/ImportExport.tsx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/web/components/dashboard/settings/ImportExport.tsx b/apps/web/components/dashboard/settings/ImportExport.tsx index f3ef13ef..1145a42d 100644 --- a/apps/web/components/dashboard/settings/ImportExport.tsx +++ b/apps/web/components/dashboard/settings/ImportExport.tsx @@ -64,14 +64,20 @@ export function ImportExportRow() { listId: string; }) => { const bookmark = toImport.bookmark; - if (bookmark.url === undefined) { - throw new Error("URL is undefined"); + if (bookmark.content === undefined) { + throw new Error("Content is undefined"); } - new URL(bookmark.url); - const created = await createBookmark({ - type: BookmarkTypes.LINK, - url: bookmark.url, - }); + const created = await createBookmark( + bookmark.content.type === BookmarkTypes.LINK + ? { + type: BookmarkTypes.LINK, + url: bookmark.content.url, + } + : { + type: BookmarkTypes.TEXT, + text: bookmark.content.text, + }, + ); await Promise.all([ // Update title and createdAt if they're set |
