Changed Backend to Supabase
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
<a v-for="item in customers" @click="selectItem(item)">
|
||||
<UCard class="listItem">
|
||||
<UBadge>{{item.attributes.customerNumber}}</UBadge> {{item.attributes.name}}
|
||||
<UBadge>{{item.customerNumber}}</UBadge> {{item.name}}
|
||||
</UCard>
|
||||
</a>
|
||||
|
||||
@@ -39,19 +39,19 @@
|
||||
|
||||
<UCard v-if="selectedItem.id">
|
||||
<template #header>
|
||||
<UBadge>{{selectedItem.attributes.customerNumber}}</UBadge> {{selectedItem.attributes.name}}
|
||||
<UBadge>{{selectedItem.customerNumber}}</UBadge> {{selectedItem.name}}
|
||||
</template>
|
||||
|
||||
Kontakte:<br>
|
||||
<ul>
|
||||
<li v-for="contact in selectedItem.attributes.contacts.data">{{contact.attributes.lastName}}, {{contact.attributes.firstName}}</li>
|
||||
</ul>
|
||||
<!-- {{selectedItem.attributes.contacts.data}}-->
|
||||
<!-- <ul>
|
||||
<li v-for="contact in selectedItem.contacts.data">{{contact.lastName}}, {{contact.firstName}}</li>
|
||||
</ul>-->
|
||||
<!-- {{selectedItem.contacts.data}}-->
|
||||
<br>
|
||||
Projekte:<br>
|
||||
<ul>
|
||||
<li v-for="project in selectedItem.attributes.projects.data"><router-link :to="'/projects?id=' + project.id">{{project.attributes.name}}</router-link></li>
|
||||
</ul>
|
||||
<!-- <ul>
|
||||
<li v-for="project in selectedItem.projects.data"><router-link :to="'/projects?id=' + project.id">{{project.name}}</router-link></li>
|
||||
</ul>-->
|
||||
|
||||
<br><br>
|
||||
|
||||
@@ -68,8 +68,13 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const {find,create} = useStrapi4()
|
||||
const customers = (await find('customers',{populate: "*"})).data
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
//const {find,create} = useStrapi4()
|
||||
//const customers = (await find('customers',{populate: "*"})).data
|
||||
|
||||
const customers = (await supabase.from("customers").select()).data
|
||||
|
||||
|
||||
|
||||
let showCreateCustomer = ref(false)
|
||||
@@ -86,8 +91,15 @@ const selectItem = (item) => {
|
||||
}
|
||||
|
||||
const createCustomer = async () => {
|
||||
await create('customers', customerInfo.value)
|
||||
console.log("Create")
|
||||
//await create('customers', customerInfo.value)
|
||||
const {data,error} = await supabase
|
||||
.from("customers")
|
||||
.insert([customerInfo.value])
|
||||
.select()
|
||||
|
||||
console.log(error)
|
||||
|
||||
|
||||
customerInfo.value = {}
|
||||
showCreateCustomer.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user