You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
737 B
Vue
25 lines
737 B
Vue
<script setup lang="ts">
|
|
import DefaultPage from '../components/DefaultPage.vue';
|
|
import EditItemForm from '../components/EditItemForm.vue';
|
|
import { useRoute } from 'vue-router';
|
|
import { useShoppingListStore} from '../store/shoppingList';
|
|
import { ref } from 'vue';
|
|
|
|
const route = useRoute();
|
|
const store = useShoppingListStore();
|
|
|
|
const item = ref(store.items.find(item => item.id === Number(route.params.id)));
|
|
</script>
|
|
|
|
<template>
|
|
<DefaultPage title="Add Item">
|
|
<v-container>
|
|
<EditItemForm v-if="item" :item="item"/>
|
|
<div v-else>
|
|
<p>This item does not exist.</p>
|
|
<v-btn color="primary" to="/shopping-list">back to shopping list</v-btn>
|
|
</div>
|
|
</v-container>
|
|
</DefaultPage>
|
|
</template>
|