Introduced ProfileStore
Corrected All Links to DataStore
This commit is contained in:
@@ -3,8 +3,9 @@ export const useNumberRange = (resourceType) => {
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
const numberRanges = dataStore.ownTenant.numberRanges
|
||||
const numberRanges = profileStore.ownTenant.numberRanges
|
||||
|
||||
const numberRange = numberRanges[resourceType]
|
||||
|
||||
@@ -19,7 +20,7 @@ export const useNumberRange = (resourceType) => {
|
||||
const {data,error} = await supabase
|
||||
.from("tenants")
|
||||
.update({numberRanges: newNumberRanges})
|
||||
.eq('id',dataStore.currentTenant)
|
||||
.eq('id',profileStore.currentTenant)
|
||||
|
||||
|
||||
dataStore.fetchOwnTenant()
|
||||
|
||||
@@ -4,9 +4,10 @@ import Handlebars from "handlebars";
|
||||
export const usePrintLabel = async (printServerId,printerName , rawZPL ) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
await supabase.from("printJobs").insert({
|
||||
tenant: dataStore.currentTenant,
|
||||
tenant: profileStore.currentTenant,
|
||||
rawContent: rawZPL,
|
||||
printerName: printerName,
|
||||
printServer: printServerId
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
export const useRole = () => {
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
|
||||
const generalAvailableRights = ref({
|
||||
@@ -178,7 +178,7 @@ export const useRole = () => {
|
||||
})
|
||||
|
||||
|
||||
let role = dataStore.activeProfile.role
|
||||
let role = profileStore.activeProfile.role
|
||||
|
||||
const checkRight = (right) => {
|
||||
let rightsToCheck = [right]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
export const useSupabaseSelect = async (relation,select = '*', sortColumn = null, ascending = true) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
let data = null
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
|
||||
data = (await supabase
|
||||
.from(relation)
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("tenant", profileStore.currentTenant)
|
||||
.order(sortColumn, {ascending: ascending})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from(relation)
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)).data
|
||||
.eq("tenant", profileStore.currentTenant)).data
|
||||
}
|
||||
|
||||
return data
|
||||
@@ -24,7 +24,8 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
|
||||
|
||||
export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null, folderPath = "_") => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
let data = null
|
||||
|
||||
|
||||
@@ -32,13 +33,13 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("tenant", profileStore.currentTenant)
|
||||
.order(sortColumn, {ascending: true})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)).data
|
||||
.eq("tenant", profileStore.currentTenant)).data
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
|
||||
|
||||
export const useSupabaseSelectSingle = async (relation,idToEq,select = '*' ) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
let data = null
|
||||
|
||||
|
||||
@@ -76,14 +77,14 @@ export const useSupabaseSelectSingle = async (relation,idToEq,select = '*' ) =>
|
||||
data = (await supabase
|
||||
.from(relation)
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("tenant", profileStore.currentTenant)
|
||||
.eq("id",idToEq)
|
||||
.single()).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from(relation)
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("tenant", profileStore.currentTenant)
|
||||
.single()).data
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user