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