mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-10 11:23:34 +02:00
plugin:yaak-models|upsert PoC
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import type { Folder } from '@yaakapp-internal/models';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import { foldersAtom, getFolder } from './useFolders';
|
||||
import { removeModelById } from './useSyncModelStores';
|
||||
import { getFolder } from './useFolders';
|
||||
|
||||
export function useDeleteFolder(id: string | null) {
|
||||
const setFolders = useSetAtom(foldersAtom);
|
||||
|
||||
return useFastMutation<Folder | null, string>({
|
||||
mutationKey: ['delete_folder', id],
|
||||
mutationFn: async () => {
|
||||
@@ -26,10 +22,5 @@ export function useDeleteFolder(id: string | null) {
|
||||
if (!confirmed) return null;
|
||||
return invokeCmd('cmd_delete_folder', { folderId: id });
|
||||
},
|
||||
onSuccess: (folder) => {
|
||||
if (folder == null) return;
|
||||
|
||||
setFolders(removeModelById(folder));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user