import type { Composer } from "vue-i18n"; import { useData, useReadOnlyStore, useStore } from "../partials/use-store-factory"; import type { IngredientFood } from "~/lib/api/types/recipe"; import { usePublicExploreApi, useUserApi } from "~/composables/api"; const store: Ref = ref([]); const loading = ref(false); const publicLoading = ref(false); export const useFoodData = function () { return useData({ id: "", name: "", description: "", labelId: undefined, }); }; export const useFoodStore = function (i18n?: Composer) { const api = useUserApi(i18n); return useStore(store, loading, api.foods); }; export const usePublicFoodStore = function (groupSlug: string, i18n?: Composer) { const api = usePublicExploreApi(groupSlug, i18n).explore; return useReadOnlyStore(store, publicLoading, api.foods); };