mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-23 15:19:31 +01:00
refac/enh: create new note
This commit is contained in:
@@ -101,30 +101,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
const createNoteHandler = async (content?: string) => {
|
||||
// $i18n.t('New Note'),
|
||||
const res = await createNewNote(localStorage.token, {
|
||||
// YYYY-MM-DD
|
||||
title: dayjs().format('YYYY-MM-DD'),
|
||||
data: {
|
||||
content: {
|
||||
json: null,
|
||||
html: content ?? '',
|
||||
md: content ?? ''
|
||||
}
|
||||
},
|
||||
meta: null,
|
||||
access_control: {}
|
||||
}).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
goto(`/notes/${res.id}`);
|
||||
}
|
||||
};
|
||||
|
||||
const downloadHandler = async (type) => {
|
||||
if (type === 'txt') {
|
||||
const blob = new Blob([selectedNote.data.content.md], { type: 'text/plain' });
|
||||
@@ -241,12 +217,6 @@
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
if ($page.url.searchParams.get('content') !== null) {
|
||||
const content = $page.url.searchParams.get('content') ?? '';
|
||||
createNoteHandler(content);
|
||||
return;
|
||||
}
|
||||
|
||||
await init();
|
||||
loaded = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user