Introduced ProfileStore

Corrected All Links to DataStore
This commit is contained in:
2024-12-21 22:33:42 +01:00
parent 813944fc23
commit b465f4a75a
64 changed files with 508 additions and 959 deletions

View File

@@ -1,5 +1,6 @@
<script setup>
const dataStore = useDataStore()
const profileStore = useProfileStore()
const route = useRoute()
const supabase = useSupabaseClient()
const toast = useToast()
@@ -43,7 +44,7 @@ const generateLink = async () => {
body: {
method: "generateLink",
institutionId: bankData.value.id,
tenant: dataStore.currentTenant
tenant: profileStore.currentTenant
}
})
@@ -62,7 +63,7 @@ const addAccount = async (account) => {
accountId: account.id,
ownerName: account.owner_name,
iban: account.iban,
tenant: dataStore.currentTenant,
tenant: profileStore.currentTenant,
bankId: account.institution_id
}

View File

@@ -2,6 +2,7 @@
import axios from "axios"
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const createEMailAddress = ref("")
const createEMailType = ref("imap")
@@ -22,7 +23,7 @@ const createAccount = async () => {
body: {
emailAddress: createEMailAddress.value,
accountType: createEMailType.value,
profile: dataStore.activeProfile.id
profile: profileStore.activeProfile.id
}
})

View File

@@ -3,6 +3,7 @@ definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const router = useRouter()
@@ -71,14 +72,14 @@ const isLight = computed({
/>
<InputGroup>
<UBadge
v-for="tag in dataStore.ownTenant.tags.documents"
v-for="tag in profileStore.ownTenant.tags.documents"
>
{{tag}}
</UBadge>
</InputGroup>
{{dataStore.ownTenant.tags}}
{{profileStore.ownTenant.tags}}
</div>
</UCard>

View File

@@ -87,6 +87,7 @@ defineShortcuts({
const router = useRouter()
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const mode = useRoute().params.mode
const openTab = ref(0)
@@ -106,7 +107,7 @@ const renderDemoZPL = () => {
const printLabel = async () => {
await supabase.from("printJobs").insert({
tenant: dataStore.currentTenant,
tenant: profileStore.currentTenant,
rawContent: useGenerateZPL(itemInfo.value.handlebarsZPL,{barcode:"XXX"}),
printerName: "ZD411",
printServer: "0dbe30f3-3008-4cde-8a7c-e785b1c22bfc"

View File

@@ -5,6 +5,8 @@ definePageMeta({
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const profileStore = useProfileStore()
@@ -38,14 +40,14 @@ const resources = {
}
}
const numberRanges = ref(dataStore.ownTenant.numberRanges)
const numberRanges = ref(profileStore.ownTenant.numberRanges)
const updateNumberRanges = async (range) => {
const {data,error} = await supabase
.from("tenants")
.update({numberRanges: numberRanges.value})
.eq('id',dataStore.currentTenant)
.eq('id',profileStore.currentTenant)
await dataStore.fetchOwnTenant()
}

View File

@@ -16,12 +16,6 @@ const setupPage = async () => {
>
</UDashboardNavbar>
{{dataStore.ownTenant.ownFields}}
</template>
<style scoped>

View File

@@ -1,6 +1,7 @@
<script setup>
const dataStore = useDataStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const itemInfo = ref({
@@ -10,17 +11,17 @@ const itemInfo = ref({
})
const setupPage = async () => {
itemInfo.value = (await supabase.from("tenants").select().eq("id",dataStore.currentTenant).single()).data
itemInfo.value = (await supabase.from("tenants").select().eq("id",profileStore.currentTenant).single()).data
console.log(itemInfo.value)
}
const features = ref(dataStore.ownTenant.features)
const businessInfo = ref(dataStore.ownTenant.businessInfo)
const features = ref(profileStore.ownTenant.features)
const businessInfo = ref(profileStore.ownTenant.businessInfo)
const updateTenant = async (newData) => {
const {data,error} = await supabase.from("tenants")
.update(newData)
.eq("id",dataStore.currentTenant)
.eq("id",profileStore.currentTenant)
.select()
if (error) console.log(error)