mealie/frontend/pages/user/_id/favorites.vue
Michael Genson 7c274de778
feat: Filter Recipes By Household (and a ton of bug fixes) (#4207)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
2024-09-22 14:59:20 +00:00

53 lines
1.3 KiB
Vue

<template>
<v-container>
<RecipeCardSection
v-if="recipes && isOwnGroup"
:icon="$globals.icons.heart"
:title="$tc('user.user-favorites')"
:recipes="recipes"
:query="query"
@sortRecipes="assignSorted"
@replaceRecipes="replaceRecipes"
@appendRecipes="appendRecipes"
@delete="removeRecipe"
/>
</v-container>
</template>
<script lang="ts">
import { defineComponent, useRoute } from "@nuxtjs/composition-api";
import RecipeCardSection from "~/components/Domain/Recipe/RecipeCardSection.vue";
import { useLazyRecipes } from "~/composables/recipes";
import { useLoggedInState } from "~/composables/use-logged-in-state";
export default defineComponent({
components: { RecipeCardSection },
middleware: "auth",
setup() {
const route = useRoute();
const { isOwnGroup } = useLoggedInState();
const userId = route.value.params.id;
const query = { queryFilter: `favoritedBy.id = "${userId}"` }
const { recipes, appendRecipes, assignSorted, removeRecipe, replaceRecipes } = useLazyRecipes();
return {
query,
recipes,
isOwnGroup,
appendRecipes,
assignSorted,
removeRecipe,
replaceRecipes,
};
},
head() {
return {
title: this.$t("general.favorites") as string,
};
},
});
</script>
<style scoped></style>