diff --git a/frontend/src/api/api-utils.js b/frontend/src/api/api-utils.js index 49f5e1fb1..8c4b0e71d 100644 --- a/frontend/src/api/api-utils.js +++ b/frontend/src/api/api-utils.js @@ -63,5 +63,7 @@ const apiReq = { }, }; + + export { apiReq }; export { baseURL }; diff --git a/frontend/src/api/backup.js b/frontend/src/api/backup.js index 057a0faeb..3ec9a1285 100644 --- a/frontend/src/api/backup.js +++ b/frontend/src/api/backup.js @@ -1,6 +1,6 @@ import { baseURL } from "./api-utils"; import { apiReq } from "./api-utils"; -import { store } from "../store"; +import { store } from "@/store"; const backupBase = baseURL + "backups/"; diff --git a/frontend/src/api/category.js b/frontend/src/api/category.js index 25377aad4..2f619fe87 100644 --- a/frontend/src/api/category.js +++ b/frontend/src/api/category.js @@ -1,5 +1,6 @@ import { baseURL } from "./api-utils"; import { apiReq } from "./api-utils"; +import { store } from "@/store"; const prefix = baseURL + "categories"; @@ -20,6 +21,7 @@ export const categoryAPI = { }, async delete(category) { let response = await apiReq.delete(categoryURLs.delete_category(category)); + store.dispatch("requestCategories"); return response.data; }, }; @@ -43,6 +45,7 @@ export const tagAPI = { }, async delete(tag) { let response = await apiReq.delete(tagURLs.deleteTag(tag)); + store.dispatch("requestTags"); return response.data; }, }; diff --git a/frontend/src/api/recipe.js b/frontend/src/api/recipe.js index ba7c76676..97a4b08c4 100644 --- a/frontend/src/api/recipe.js +++ b/frontend/src/api/recipe.js @@ -43,6 +43,7 @@ export const recipeAPI = { async create(recipeData) { let response = await apiReq.post(recipeURLs.create, recipeData); + store.dispatch("requestRecentRecipes"); return response.data; }, @@ -62,15 +63,13 @@ export const recipeAPI = { }, async update(data) { - const recipeSlug = data.slug; - - let response = await apiReq.put(recipeURLs.update(recipeSlug), data); + let response = await apiReq.put(recipeURLs.update(data.slug), data); store.dispatch("requestRecentRecipes"); return response.data; }, async delete(recipeSlug) { - apiReq.delete(recipeURLs.delete(recipeSlug)); + await apiReq.delete(recipeURLs.delete(recipeSlug)); store.dispatch("requestRecentRecipes"); router.push(`/`); },