import { writable } from 'svelte/store'; const { set, update, subscribe } = writable([]); const addTask = (task: Task) => { update((tasks) => [...tasks, { ...task, id: `https://pod.5ika.ch/tasks/default#${Date.now()}` }]); }; const updateTask = (taskId: string, taskUpdate: Partial) => { update((tasks) => tasks.map((task) => { if (task.id === taskId) return { ...task, ...taskUpdate }; return task; }) ); }; const deleteTask = (taskId: string) => { update((tasks) => tasks.filter((task) => task.id !== taskId)); }; export default { set, update, subscribe, addTask, updateTask, deleteTask };