mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-31 20:25:14 -04:00
* move api clients and rename * organize recipes composables * rewrite useRecipeContext * refactor(frontend): ♻️ abstract common ingredient functionality. * feat(frontend): ✨ add scale, and back to recipe button + hide ingredients if none * update regex to mach 11. instead of just 1. * minor UX improvements Co-authored-by: Hayden K <hay-kot@pm.me>
49 lines
1.1 KiB
Vue
49 lines
1.1 KiB
Vue
<template>
|
|
<v-container>
|
|
<RecipeCardSection
|
|
v-if="category"
|
|
:icon="$globals.icons.tags"
|
|
:title="category.name"
|
|
:recipes="category.recipes"
|
|
@sort="assignSorted"
|
|
></RecipeCardSection>
|
|
</v-container>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, useAsync, useRoute } from "@nuxtjs/composition-api";
|
|
import RecipeCardSection from "~/components/Domain/Recipe/RecipeCardSection.vue";
|
|
import { useUserApi } from "~/composables/api";
|
|
import { Recipe } from "~/types/api-types/recipe";
|
|
|
|
export default defineComponent({
|
|
components: { RecipeCardSection },
|
|
setup() {
|
|
const api = useUserApi();
|
|
const route = useRoute();
|
|
const slug = route.value.params.slug;
|
|
|
|
const category = useAsync(async () => {
|
|
const { data } = await api.categories.getOne(slug);
|
|
return data;
|
|
}, slug);
|
|
return { category };
|
|
},
|
|
head() {
|
|
return {
|
|
title: this.$t("sidebar.categories") as string,
|
|
};
|
|
},
|
|
methods: {
|
|
assignSorted(val: Array<Recipe>) {
|
|
if (this.category) {
|
|
// @ts-ignore
|
|
this.category.recipes = val;
|
|
}
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
</style> |