mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 18:53:17 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			708 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			708 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
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}`,
 | 
						|
};
 | 
						|
 | 
						|
export class CategoriesAPI extends BaseCRUDAPI<CategoryIn, RecipeCategoryResponse> {
 | 
						|
  baseRoute: string = routes.categories;
 | 
						|
  itemRoute = routes.categoriesId;
 | 
						|
 | 
						|
  async bySlug(slug: string) {
 | 
						|
    return await this.requests.get<RecipeCategoryResponse>(routes.categoriesSlug(slug));
 | 
						|
  }
 | 
						|
}
 |