| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  | import { BaseCRUDAPI } from "../_base"; | 
					
						
							| 
									
										
										
										
											2022-01-16 03:38:11 +01:00
										 |  |  | import { RecipeTool, RecipeToolCreate, RecipeToolResponse } from "~/types/api-types/recipe"; | 
					
						
							| 
									
										
										
										
											2021-11-22 20:10:48 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  | import { config } from "~/api/config"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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-01-16 03:38:11 +01:00
										 |  |  | export class ToolsApi extends BaseCRUDAPI<RecipeTool, RecipeToolCreate> { | 
					
						
							| 
									
										
										
										
											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
										 |  |  | } |