fixed navigating with global search

This commit is contained in:
vabene1111
2024-12-19 20:21:00 +01:00
parent ecdb1e9fee
commit 1c9d19fc76
36 changed files with 145 additions and 9 deletions

View File

@@ -6,7 +6,7 @@
</template>
<script setup lang="ts">
import {defineComponent, onMounted, ref} from 'vue'
import {defineComponent, onMounted, ref, watch} from 'vue'
import {ApiApi, Recipe} from "@/openapi";
import RecipeView from "@/components/display/RecipeView.vue";
import {useDisplay} from "vuetify";
@@ -19,12 +19,17 @@ const {mobile} = useDisplay()
const recipe = ref({} as Recipe)
watch(() => props.id, () => {
refreshData(props.id)
})
onMounted(() => {
refreshData(props.id)
})
function refreshData(recipeId: string) {
const api = new ApiApi()
recipe.value = {} as Recipe
api.apiRecipeRetrieve({id: Number(recipeId)}).then(r => {
recipe.value = r
})