mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: make topics optional in importer
This commit is contained in:
committed by
Abdullah Atta
parent
4de5691428
commit
ec76be776c
@@ -116,17 +116,11 @@ async function importNotebook(notebook: Notebook) {
|
||||
if (!nb) {
|
||||
const nbId = await db.notebooks?.add({
|
||||
title: notebook.notebook,
|
||||
topics: [notebook.topic]
|
||||
topics: notebook.topic ? [notebook.topic] : []
|
||||
});
|
||||
nb = db.notebooks?.notebook(nbId).data;
|
||||
}
|
||||
|
||||
let topic = nb?.topics.find((t: any) => t.title === notebook.topic);
|
||||
if (!topic) {
|
||||
const topics = db.notebooks?.notebook(nb).topics;
|
||||
await topics?.add(notebook.topic);
|
||||
topic = topics?.all.find((t) => t.title === notebook.topic);
|
||||
}
|
||||
const topic = nb?.topics.find((t: any) => t.title === notebook.topic);
|
||||
|
||||
return { id: nb.id, topic: topic.id };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user