2021-07-31 14:45:28 -08:00
|
|
|
<template>
|
2022-06-13 09:33:46 -08:00
|
|
|
<v-container>
|
2024-04-11 21:28:43 -05:00
|
|
|
<RecipeCardSection
|
|
|
|
v-if="recipes && isOwnGroup"
|
|
|
|
:icon="$globals.icons.heart"
|
2025-06-20 00:09:12 +07:00
|
|
|
:title="$t('user.user-favorites')"
|
2024-04-11 21:28:43 -05:00
|
|
|
:recipes="recipes"
|
2024-09-22 09:59:20 -05:00
|
|
|
:query="query"
|
2025-06-20 00:09:12 +07:00
|
|
|
@sort-recipes="assignSorted"
|
|
|
|
@replace-recipes="replaceRecipes"
|
|
|
|
@append-recipes="appendRecipes"
|
2024-09-22 09:59:20 -05:00
|
|
|
@delete="removeRecipe"
|
2024-04-11 21:28:43 -05:00
|
|
|
/>
|
2022-06-13 09:33:46 -08:00
|
|
|
</v-container>
|
2021-07-31 15:07:19 -08:00
|
|
|
</template>
|
2022-06-13 09:33:46 -08:00
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import RecipeCardSection from "~/components/Domain/Recipe/RecipeCardSection.vue";
|
2024-09-22 09:59:20 -05:00
|
|
|
import { useLazyRecipes } from "~/composables/recipes";
|
2023-11-05 19:07:02 -06:00
|
|
|
import { useLoggedInState } from "~/composables/use-logged-in-state";
|
2021-07-31 15:07:19 -08:00
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
export default defineNuxtComponent({
|
2022-06-13 09:33:46 -08:00
|
|
|
components: { RecipeCardSection },
|
2025-06-20 00:09:12 +07:00
|
|
|
middleware: "sidebase-auth",
|
2021-07-31 15:07:19 -08:00
|
|
|
setup() {
|
2022-06-13 09:33:46 -08:00
|
|
|
const route = useRoute();
|
2025-06-20 00:09:12 +07:00
|
|
|
const i18n = useI18n();
|
2023-11-05 19:07:02 -06:00
|
|
|
const { isOwnGroup } = useLoggedInState();
|
2022-06-13 09:33:46 -08:00
|
|
|
|
2025-06-20 00:09:12 +07:00
|
|
|
useSeoMeta({
|
|
|
|
title: i18n.t("general.favorites"),
|
|
|
|
});
|
|
|
|
|
|
|
|
const userId = route.params.id;
|
|
|
|
const query = { queryFilter: `favoritedBy.id = "${userId}"` };
|
2024-09-22 09:59:20 -05:00
|
|
|
const { recipes, appendRecipes, assignSorted, removeRecipe, replaceRecipes } = useLazyRecipes();
|
2022-06-13 09:33:46 -08:00
|
|
|
|
|
|
|
return {
|
2024-09-22 09:59:20 -05:00
|
|
|
query,
|
2024-04-11 21:28:43 -05:00
|
|
|
recipes,
|
2023-11-05 19:07:02 -06:00
|
|
|
isOwnGroup,
|
2024-09-22 09:59:20 -05:00
|
|
|
appendRecipes,
|
|
|
|
assignSorted,
|
|
|
|
removeRecipe,
|
|
|
|
replaceRecipes,
|
2022-06-13 09:33:46 -08:00
|
|
|
};
|
2021-07-31 15:07:19 -08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2022-06-13 09:33:46 -08:00
|
|
|
|
|
|
|
<style scoped></style>
|