mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
enh: delete notes
This commit is contained in:
parent
18149483f2
commit
f716968009
@ -31,7 +31,7 @@
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { WEBUI_NAME, config, prompts as _prompts, user } from '$lib/stores';
|
||||
|
||||
import { createNewNote, getNotes } from '$lib/apis/notes';
|
||||
import { createNewNote, deleteNoteById, getNotes } from '$lib/apis/notes';
|
||||
import { capitalizeFirstLetter } from '$lib/utils';
|
||||
|
||||
import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte';
|
||||
@ -155,6 +155,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
const deleteNoteHandler = async (id) => {
|
||||
const res = await deleteNoteById(localStorage.token, id).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
init();
|
||||
}
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
await init();
|
||||
loaded = true;
|
||||
@ -171,7 +182,10 @@
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete note?')}
|
||||
on:confirm={() => {}}
|
||||
on:confirm={() => {
|
||||
deleteNoteHandler(selectedNote.id);
|
||||
showDeleteConfirm = false;
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-gray-500">
|
||||
{$i18n.t('This will delete')} <span class=" font-semibold">{selectedNote.title}</span>.
|
||||
|
Loading…
Reference in New Issue
Block a user