open-webui/src/lib/components/notes/utils.ts

28 lines
516 B
TypeScript
Raw Normal View History

2025-11-19 19:14:53 +00:00
import { toast } from 'svelte-sonner';
import { createNewNote } from '$lib/apis/notes';
2025-11-17 00:17:08 +00:00
2025-11-19 19:14:53 +00:00
export const createNoteHandler = async (title: string, content?: string) => {
// $i18n.t('New Note'),
const res = await createNewNote(localStorage.token, {
// YYYY-MM-DD
title: title,
data: {
content: {
json: null,
html: content ?? '',
md: content ?? ''
}
},
meta: null,
access_control: {}
}).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
return res;
}
};