mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-03 15:41:21 -05:00
feature/favorite-recipes (#443)
* add favorites options * bump dependencies * add badges to all cards * typo * remove console.log * fix site-loader viewport Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { baseURL } from "./api-utils";
|
||||
import { API_ROUTES } from "./apiRoutes";
|
||||
import { apiReq } from "./api-utils";
|
||||
import axios from "axios";
|
||||
import i18n from "@/i18n.js";
|
||||
@@ -91,6 +92,27 @@ export const userAPI = {
|
||||
const response = await apiReq.delete(usersURLs.userAPIDelete(id));
|
||||
return response.data;
|
||||
},
|
||||
/** Adds a Recipe to the users favorites
|
||||
* @param id
|
||||
*/
|
||||
async getFavorites(id) {
|
||||
const response = await apiReq.get(API_ROUTES.usersIdFavorites(id));
|
||||
return response.data;
|
||||
},
|
||||
/** Adds a Recipe to the users favorites
|
||||
* @param id
|
||||
*/
|
||||
async addFavorite(id, slug) {
|
||||
const response = await apiReq.post(API_ROUTES.usersIdFavoritesSlug(id, slug));
|
||||
return response.data;
|
||||
},
|
||||
/** Adds a Recipe to the users favorites
|
||||
* @param id
|
||||
*/
|
||||
async removeFavorite(id, slug) {
|
||||
const response = await apiReq.delete(API_ROUTES.usersIdFavoritesSlug(id, slug));
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
const deleteErrorText = response => {
|
||||
|
||||
Reference in New Issue
Block a user