Added Frontend
This commit is contained in:
25
frontend/composables/useErrorLogging.js
Normal file
25
frontend/composables/useErrorLogging.js
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
export const useErrorLogging = (resourceType) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const toast = useToast()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
const logError = async (error) => {
|
||||
let errorData = {
|
||||
message: error,
|
||||
tenant: profileStore.currentTenant,
|
||||
profile: profileStore.activeProfile.id
|
||||
}
|
||||
|
||||
const {data:supabaseData,error:supabaseError} = await supabase.from("errors").insert(errorData).select().single()
|
||||
|
||||
if(supabaseError) {
|
||||
console.error(supabaseError)
|
||||
} else if(supabaseData) {
|
||||
return supabaseData.id
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return { logError}
|
||||
}
|
||||
Reference in New Issue
Block a user