mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	
		
			
	
	
		
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { useContext } from "@nuxtjs/composition-api";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export const useStaticRoutes = () => {
							 | 
						||
| 
								 | 
							
								  const { $config } = useContext();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const prefix = `${$config.SUB_PATH}/api`.replace("//", "/");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Methods to Generate reference urls for assets/images *
							 | 
						||
| 
								 | 
							
								  function recipeImage(recipeSlug: string, version = null, key = null) {
							 | 
						||
| 
								 | 
							
								    return `${prefix}/media/recipes/${recipeSlug}/images/original.webp?&rnd=${key}&version=${version}`;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  function recipeSmallImage(recipeSlug: string, version = null, key = null) {
							 | 
						||
| 
								 | 
							
								    return `${prefix}/media/recipes/${recipeSlug}/images/min-original.webp?&rnd=${key}&version=${version}`;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  function recipeTinyImage(recipeSlug: string, version = null, key = null) {
							 | 
						||
| 
								 | 
							
								    return `${prefix}/media/recipes/${recipeSlug}/images/tiny-original.webp?&rnd=${key}&version=${version}`;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  function recipeAssetPath(recipeSlug: string, assetName: string) {
							 | 
						||
| 
								 | 
							
								    return `${prefix}/media/recipes/${recipeSlug}/assets/${assetName}`;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return {
							 | 
						||
| 
								 | 
							
								    recipeImage,
							 | 
						||
| 
								 | 
							
								    recipeSmallImage,
							 | 
						||
| 
								 | 
							
								    recipeTinyImage,
							 | 
						||
| 
								 | 
							
								    recipeAssetPath,
							 | 
						||
| 
								 | 
							
								  };
							 | 
						||
| 
								 | 
							
								};
							 |