mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-30 17:53:31 -04:00 
			
		
		
		
	fix: Restore recipe meta for non-logged-in users (#6286)
This commit is contained in:
		| @@ -19,20 +19,21 @@ import type { Recipe } from "~/lib/api/types/recipe"; | ||||
| const $auth = useMealieAuth(); | ||||
| const { isOwnGroup } = useLoggedInState(); | ||||
| const route = useRoute(); | ||||
| const title = ref(route.meta?.title ?? ""); | ||||
| const title = ref(route.meta?.title as string || ""); | ||||
| useSeoMeta({ title }); | ||||
|  | ||||
| const router = useRouter(); | ||||
| const slug = route.params.slug as string; | ||||
|  | ||||
| const recipe = ref<Recipe | null>(null); | ||||
| if (isOwnGroup.value) { | ||||
| function loadRecipe() { | ||||
|   const { recipe: data } = useRecipe(slug); | ||||
|   watch(data, (value) => { | ||||
|     recipe.value = value; | ||||
|   }); | ||||
| } | ||||
| else { | ||||
|  | ||||
| async function loadPublicRecipe() { | ||||
|   const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || ""); | ||||
|   const api = usePublicExploreApi(groupSlug.value); | ||||
|   const { data } = await useAsyncData(useAsyncKey(), async () => { | ||||
| @@ -47,6 +48,13 @@ else { | ||||
|   recipe.value = data.value; | ||||
| } | ||||
|  | ||||
| if (isOwnGroup.value) { | ||||
|   loadRecipe(); | ||||
| } | ||||
| else { | ||||
|   onMounted(loadPublicRecipe); | ||||
| } | ||||
|  | ||||
| whenever( | ||||
|   () => recipe.value, | ||||
|   () => { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ const router = useRouter(); | ||||
| const recipeId = route.params.id as string; | ||||
| const api = usePublicApi(); | ||||
|  | ||||
| const title = ref(route.meta?.title ?? ""); | ||||
| const title = ref(route.meta?.title as string ?? ""); | ||||
| useSeoMeta({ | ||||
|   title, | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user