Fix: Add error handling to audit logger

This commit is contained in:
2025-12-03 22:59:48 +03:00
parent 80baa907ab
commit df778f11bf

View File

@@ -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)
}
} }