1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 05:25:26 +02:00

feat: public recipe access (#1610)

* initial public explorer API endpoint

* public API endpoint

* cleanup recipe page

* wip: init explorer page

* use public URLs for shared recipes

* refactor private share tokens to use shared page
This commit is contained in:
Hayden 2022-08-28 20:08:33 -08:00 committed by GitHub
parent 9ea5e6584f
commit 18b2c92a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 361 additions and 437 deletions

View file

@ -0,0 +1,50 @@
<template>
<div>
<client-only>
<RecipePage v-if="recipe" :recipe="recipe" />
</client-only>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, useAsync, useMeta, useRoute, useRouter } from "@nuxtjs/composition-api";
import RecipePage from "~/components/Domain/Recipe/RecipePage/RecipePage.vue";
import { usePublicApi } from "~/composables/api/api-client";
import { useRecipeMeta } from "~/composables/recipes";
export default defineComponent({
components: { RecipePage },
layout: "basic",
setup() {
const route = useRoute();
const router = useRouter();
const groupId = route.value.params.groupId;
const slug = route.value.params.slug;
const api = usePublicApi();
const { meta, title } = useMeta();
const recipe = useAsync(async () => {
const { data, error } = await api.explore.recipe(groupId, slug);
if (error) {
console.error("error loading recipe -> ", error);
router.push("/");
}
if (data) {
title.value = data?.name || "";
const metaObj = useRecipeMeta(ref(data));
meta.value = metaObj().meta;
}
return data;
});
return {
recipe,
};
},
head: {},
});
</script>