fix: Optimize Recipe Favorites/Ratings (#6075)

This commit is contained in:
Michael Genson
2025-09-03 09:56:38 -05:00
committed by GitHub
parent 1cdf43c599
commit 461e51bd22
12 changed files with 142 additions and 28 deletions

View File

@@ -43,8 +43,6 @@ const props = withDefaults(defineProps<Props>(), {
buttonStyle: false,
});
const api = useUserApi();
const $auth = useMealieAuth();
const { userRatings, refreshUserRatings } = useUserSelfRatings();
const isFavorite = computed(() => {
@@ -53,6 +51,9 @@ const isFavorite = computed(() => {
});
async function toggleFavorite() {
const api = useUserApi();
const $auth = useMealieAuth();
if (!$auth.user.value) return;
if (!isFavorite.value) {
await api.users.addFavorite($auth.user.value?.id, props.recipeId);