| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  | import { BaseCRUDAPI } from "../_base"; | 
					
						
							|  |  |  | import { CategoryIn, RecipeCategoryResponse } from "~/types/api-types/recipe"; | 
					
						
							|  |  |  | import { config } from "~/api/config"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const prefix = config.PREFIX + "/organizers"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const routes = { | 
					
						
							|  |  |  |   categories: `${prefix}/categories`, | 
					
						
							|  |  |  |   categoriesId: (category: string) => `${prefix}/categories/${category}`, | 
					
						
							|  |  |  |   categoriesSlug: (category: string) => `${prefix}/categories/slug/${category}`, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 21:22:02 +02:00
										 |  |  | export class CategoriesAPI extends BaseCRUDAPI<CategoryIn, RecipeCategoryResponse> { | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |   baseRoute: string = routes.categories; | 
					
						
							|  |  |  |   itemRoute = routes.categoriesId; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   async bySlug(slug: string) { | 
					
						
							|  |  |  |     return await this.requests.get<RecipeCategoryResponse>(routes.categoriesSlug(slug)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |