1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-19 13:19:41 +02:00
mealie/frontend/composables/store/use-unit-store.ts

22 lines
563 B
TypeScript
Raw Normal View History

import { useData, useStore } from "../partials/use-store-factory";
import type { IngredientUnit } from "~/lib/api/types/recipe";
import { useUserApi } from "~/composables/api";
const store: Ref<IngredientUnit[]> = ref([]);
const loading = ref(false);
export const useUnitData = function () {
return useData<IngredientUnit>({
id: "",
name: "",
fraction: true,
abbreviation: "",
description: "",
});
};
export const useUnitStore = function () {
const api = useUserApi();
return useStore<IngredientUnit>(store, loading, api.units);
};