| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { BaseCRUDAPI } from "../base/base-clients"; | 
					
						
							|  |  |  | import { config } from "../config"; | 
					
						
							|  |  |  | import { RecipeTool, RecipeToolCreate, RecipeToolResponse } from "~/lib/api/types/recipe"; | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | const prefix = config.PREFIX + "/organizers"; | 
					
						
							| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | const routes = { | 
					
						
							|  |  |  |   tools: `${prefix}/tools`, | 
					
						
							|  |  |  |   toolsId: (id: string) => `${prefix}/tools/${id}`, | 
					
						
							| 
									
										
										
										
											2021-12-10 19:48:06 -09:00
										 |  |  |   toolsSlug: (id: string) => `${prefix}/tools/slug/${id}`, | 
					
						
							| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 21:22:02 +02:00
										 |  |  | export class ToolsApi extends BaseCRUDAPI<RecipeToolCreate, RecipeTool> { | 
					
						
							| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  |   baseRoute: string = routes.tools; | 
					
						
							|  |  |  |   itemRoute = routes.toolsId; | 
					
						
							| 
									
										
										
										
											2021-12-10 19:48:06 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |   async bySlug(slug: string) { | 
					
						
							| 
									
										
										
										
											2022-01-16 03:38:11 +01:00
										 |  |  |     return await this.requests.get<RecipeToolResponse>(routes.toolsSlug(slug)); | 
					
						
							| 
									
										
										
										
											2021-12-10 19:48:06 -09:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  | } |