import { type Writable, writable } from 'svelte/store'
import { type Food, FoodService } from '$lib/database/food'


async function createStore(): Promise<Writable<Food[]>> {
	const foods = await FoodService.GetAllForDate(new Date())
	const { subscribe, update, set } = writable(foods)
	return {
		subscribe,
		update,
		set
	}
}

export const foodStore = await createStore()
