diff --git a/frontend/components/Domain/Recipe/RecipeRating.vue b/frontend/components/Domain/Recipe/RecipeRating.vue index 6df9cd2f1418..435387800950 100644 --- a/frontend/components/Domain/Recipe/RecipeRating.vue +++ b/frontend/components/Domain/Recipe/RecipeRating.vue @@ -10,6 +10,7 @@ :size="small ? 15 : undefined" hover :value="value" + clearable @input="updateRating" @click="updateRating" > @@ -52,7 +53,10 @@ export default defineComponent({ const rating = ref(props.value); const api = useUserApi(); - function updateRating(val: number) { + function updateRating(val: number | null) { + if (val === 0) { + val = null; + } if (!props.emitOnly) { api.recipes.patchOne(props.slug, { rating: val, diff --git a/frontend/lib/api/types/recipe.ts b/frontend/lib/api/types/recipe.ts index 5ed3126b6b29..0b129cacb914 100644 --- a/frontend/lib/api/types/recipe.ts +++ b/frontend/lib/api/types/recipe.ts @@ -206,7 +206,7 @@ export interface Recipe { recipeCategory?: RecipeCategory[]; tags?: RecipeTag[]; tools?: RecipeTool[]; - rating?: number; + rating?: number | null; orgURL?: string; dateAdded?: string; dateUpdated?: string;