Fix: Add error handling to audit logger
This commit is contained in:
@@ -11,11 +11,18 @@ export async function logAction(
|
|||||||
|
|
||||||
if (!user) return
|
if (!user) return
|
||||||
|
|
||||||
await supabase.from('audit_logs').insert({
|
try {
|
||||||
user_id: user.id,
|
const { error } = await supabase.from('audit_logs').insert({
|
||||||
action,
|
user_id: user.id,
|
||||||
entity_type: entityType,
|
action,
|
||||||
entity_id: entityId,
|
entity_type: entityType,
|
||||||
details,
|
entity_id: entityId,
|
||||||
})
|
details,
|
||||||
|
})
|
||||||
|
if (error) {
|
||||||
|
console.error("Audit log error:", error)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Audit log exception:", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user