Changed STore Type and corrected all Pages

Added HistoryDisplay.vue
Added NumberRanges
This commit is contained in:
2023-12-27 21:52:55 +01:00
parent 9e092823e4
commit c41b99f29d
33 changed files with 1094 additions and 812 deletions

View File

@@ -3,18 +3,13 @@ definePageMeta({
middleware: "auth"
})
//
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
const toast = useToast()
const id = ref(route.params.id ? route.params.id : null )
//Store
const {vendors } = storeToRefs(useDataStore())
const {fetchVendors, getVendorById} = useDataStore()
let currentItem = null
@@ -26,7 +21,7 @@ const itemInfo = ref({})
//Functions
const setupPage = () => {
if(mode.value === "show" || mode.value === "edit"){
currentItem = getVendorById(Number(useRoute().params.id))
currentItem = dataStore.getVendorById(Number(useRoute().params.id))
}
if(mode.value === "edit") itemInfo.value = currentItem
@@ -47,7 +42,7 @@ const createItem = async () => {
mode.value = "show"
itemInfo.value = {}
toast.add({title: "Lieferant erfolgreich erstellt"})
await fetchVendors()
await dataStore.fetchVendors()
router.push(`/vendors/show/${data[0].id}`)
setupPage()
}
@@ -74,7 +69,7 @@ const updateItem = async () => {
mode.value = "show"
itemInfo.value = {}
toast.add({title: "Lieferant erfolgreich gespeichert"})
fetchVendors()
dataStore.fetchVendors()
}