| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  | function UnknownToString(ukn: string | unknown) { | 
					
						
							|  |  |  |   return typeof ukn === "string" ? ukn : ""; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  | export const useStaticRoutes = () => { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   const { $config } = useNuxtApp(); | 
					
						
							|  |  |  |   const prefix = `${$config.public.SUB_PATH}/api`.replace("//", "/"); | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Methods to Generate reference urls for assets/images *
 | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  |   function recipeImage(recipeId: string, version: string | unknown = "", key: string | number = 1) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/original.webp?rnd=${key}&version=${UnknownToString(version)}`; | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  |   function recipeSmallImage(recipeId: string, version: string | unknown = "", key: string | number = 1) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/min-original.webp?rnd=${key}&version=${UnknownToString( | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       version, | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  |     )}`;
 | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  |   function recipeTinyImage(recipeId: string, version: string | unknown = "", key: string | number = 1) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/tiny-original.webp?rnd=${key}&version=${UnknownToString( | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       version, | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  |     )}`;
 | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-06 12:49:30 -05:00
										 |  |  |   function recipeTimelineEventImage(recipeId: string, timelineEventId: string) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/timeline/${timelineEventId}/original.webp`; | 
					
						
							| 
									
										
										
										
											2023-08-06 12:49:30 -05:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   function recipeTimelineEventSmallImage(recipeId: string, timelineEventId: string) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/timeline/${timelineEventId}/min-original.webp`; | 
					
						
							| 
									
										
										
										
											2023-08-06 12:49:30 -05:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   function recipeTimelineEventTinyImage(recipeId: string, timelineEventId: string) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/images/timeline/${timelineEventId}/tiny-original.webp`; | 
					
						
							| 
									
										
										
										
											2023-08-06 12:49:30 -05:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |   function recipeAssetPath(recipeId: string, assetName: string) { | 
					
						
							| 
									
										
										
										
											2025-08-16 10:41:46 +02:00
										 |  |  |     return `${prefix}/media/recipes/${recipeId}/assets/${assetName}`; | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return { | 
					
						
							|  |  |  |     recipeImage, | 
					
						
							|  |  |  |     recipeSmallImage, | 
					
						
							|  |  |  |     recipeTinyImage, | 
					
						
							| 
									
										
										
										
											2023-08-06 12:49:30 -05:00
										 |  |  |     recipeTimelineEventImage, | 
					
						
							|  |  |  |     recipeTimelineEventSmallImage, | 
					
						
							|  |  |  |     recipeTimelineEventTinyImage, | 
					
						
							| 
									
										
										
										
											2021-08-09 16:19:23 -08:00
										 |  |  |     recipeAssetPath, | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | }; |