mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-26 05:34:21 -05:00
feature/recipe-comments (#448)
* fix favorite color issue * db and models for comments * rename files * initial UI for comments * fix format * import / export * fixes #428 * format Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -65,6 +65,8 @@ export const API_ROUTES = {
|
||||
recipesRecipeSlug: (recipe_slug) => `${prefix}/recipes/${recipe_slug}`,
|
||||
recipesRecipeSlugAssets: (recipe_slug) => `${prefix}/recipes/${recipe_slug}/assets`,
|
||||
recipesRecipeSlugImage: (recipe_slug) => `${prefix}/recipes/${recipe_slug}/image`,
|
||||
recipesSlugComments: (slug) => `${prefix}/recipes/${slug}/comments`,
|
||||
recipesSlugCommentsId: (slug, id) => `${prefix}/recipes/${slug}/comments/${id}`,
|
||||
shoppingListsId: (id) => `${prefix}/shopping-lists/${id}`,
|
||||
siteSettingsCustomPagesId: (id) => `${prefix}/site-settings/custom-pages/${id}`,
|
||||
tagsTag: (tag) => `${prefix}/tags/${tag}`,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { baseURL } from "./api-utils";
|
||||
import { API_ROUTES } from "./apiRoutes";
|
||||
import { apiReq } from "./api-utils";
|
||||
import { baseURL } from "./api-utils";
|
||||
import { store } from "../store";
|
||||
import i18n from "@/i18n.js";
|
||||
|
||||
@@ -161,4 +162,28 @@ export const recipeAPI = {
|
||||
recipeAssetPath(recipeSlug, assetName) {
|
||||
return `api/media/recipes/${recipeSlug}/assets/${assetName}`;
|
||||
},
|
||||
|
||||
/** Create comment in the Database
|
||||
* @param slug
|
||||
*/
|
||||
async createComment(slug, data) {
|
||||
const response = await apiReq.post(API_ROUTES.recipesSlugComments(slug), data);
|
||||
return response.data;
|
||||
},
|
||||
/** Update comment in the Database
|
||||
* @param slug
|
||||
* @param id
|
||||
*/
|
||||
async updateComment(slug, id, data) {
|
||||
const response = await apiReq.put(API_ROUTES.recipesSlugCommentsId(slug, id), data);
|
||||
return response.data;
|
||||
},
|
||||
/** Delete comment from the Database
|
||||
* @param slug
|
||||
* @param id
|
||||
*/
|
||||
async deleteComment(slug, id) {
|
||||
const response = await apiReq.delete(API_ROUTES.recipesSlugCommentsId(slug, id));
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user