mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			829 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			829 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { ref, Ref } from "@nuxtjs/composition-api";
 | |
| import { useData, useReadOnlyStore, useStore } from "../partials/use-store-factory";
 | |
| import { RecipeTool } from "~/lib/api/types/recipe";
 | |
| import { usePublicExploreApi, useUserApi } from "~/composables/api";
 | |
| 
 | |
| const store: Ref<RecipeTool[]> = ref([]);
 | |
| const loading = ref(false);
 | |
| const publicLoading = ref(false);
 | |
| 
 | |
| export const useToolData = function () {
 | |
|   return useData<RecipeTool>({
 | |
|     id: "",
 | |
|     name: "",
 | |
|     slug: "",
 | |
|     onHand: false,
 | |
|   });
 | |
| }
 | |
| 
 | |
| export const useToolStore = function () {
 | |
|   const api = useUserApi();
 | |
|   return useStore<RecipeTool>(store, loading, api.tools);
 | |
| }
 | |
| 
 | |
| export const usePublicToolStore = function (groupSlug: string) {
 | |
|   const api = usePublicExploreApi(groupSlug).explore;
 | |
|   return useReadOnlyStore<RecipeTool>(store, publicLoading, api.tools);
 | |
| }
 |