delete project from store on delete

This commit is contained in:
Nikita Galaiko 2023-05-09 14:21:59 +02:00
parent cf08bb8a24
commit 5e20cdaeb5

View File

@ -1,6 +1,6 @@
import { invoke } from '$lib/ipc';
import type { Project as ApiProject } from '$lib/api/cloud';
import { asyncWritable, derived, type WritableLoadable } from '@square/svelte-store';
import { asyncWritable, derived } from '@square/svelte-store';
export type Project = {
id: string;
@ -47,7 +47,8 @@ export const Projects = () => {
store.update((projects) => projects.map((p) => (p.id === project.id ? project : p)));
return project;
}),
delete: () => del({ id })
delete: () =>
del({ id }).then(() => store.update((projects) => projects.filter((p) => p.id !== id)))
};
},
add: (params: { path: string }) =>