2021-07-31 22:45:28 +00:00
|
|
|
<template>
|
2021-08-03 06:15:11 +00:00
|
|
|
<v-container>
|
|
|
|
<RecipeCardSection
|
|
|
|
:icon="$globals.icons.primary"
|
|
|
|
:title="$t('page.all-recipes')"
|
|
|
|
:recipes="recipes"
|
|
|
|
@sort="assignSorted"
|
|
|
|
></RecipeCardSection>
|
|
|
|
</v-container>
|
|
|
|
</template>
|
2021-07-31 22:45:28 +00:00
|
|
|
|
|
|
|
<script lang="ts">
|
2021-08-03 06:15:11 +00:00
|
|
|
import { defineComponent, onMounted, ref } from "@nuxtjs/composition-api";
|
|
|
|
import RecipeCardSection from "~/components/Domain/Recipe/RecipeCardSection.vue";
|
|
|
|
import { useApiSingleton } from "~/composables/use-api";
|
|
|
|
import { Recipe } from "~/types/api-types/admin";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: { RecipeCardSection },
|
|
|
|
setup() {
|
|
|
|
const api = useApiSingleton();
|
|
|
|
|
|
|
|
const recipes = ref<Recipe[] | null>([]);
|
|
|
|
onMounted(async () => {
|
|
|
|
const { data } = await api.recipes.getAll();
|
|
|
|
recipes.value = data;
|
|
|
|
});
|
|
|
|
|
|
|
|
return { api, recipes };
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
assignSorted(val: Array<Recipe>) {
|
|
|
|
this.recipes = val;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|