Debug: Add logging to Audit Logs page to diagnose empty list
This commit is contained in:
@@ -22,8 +22,9 @@ export default async function AuditLogsPage() {
|
|||||||
|
|
||||||
// Use admin client if available to bypass RLS for debugging
|
// Use admin client if available to bypass RLS for debugging
|
||||||
const client = supabaseAdmin || supabase
|
const client = supabaseAdmin || supabase
|
||||||
|
console.log("AuditLogsPage: Using admin client?", !!supabaseAdmin)
|
||||||
|
|
||||||
const { data: logs } = await client
|
const { data: logs, error } = await client
|
||||||
.from('audit_logs')
|
.from('audit_logs')
|
||||||
.select(`
|
.select(`
|
||||||
*,
|
*,
|
||||||
@@ -32,6 +33,12 @@ export default async function AuditLogsPage() {
|
|||||||
.order('created_at', { ascending: false })
|
.order('created_at', { ascending: false })
|
||||||
.limit(50)
|
.limit(50)
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
console.error("AuditLogsPage: Error fetching logs:", error)
|
||||||
|
} else {
|
||||||
|
console.log("AuditLogsPage: Fetched logs count:", logs?.length)
|
||||||
|
}
|
||||||
|
|
||||||
const getActionBadge = (action: string) => {
|
const getActionBadge = (action: string) => {
|
||||||
if (action.includes('create')) return <Badge variant="default">Oluşturma</Badge>
|
if (action.includes('create')) return <Badge variant="default">Oluşturma</Badge>
|
||||||
if (action.includes('update')) return <Badge variant="secondary">Güncelleme</Badge>
|
if (action.includes('update')) return <Badge variant="secondary">Güncelleme</Badge>
|
||||||
|
|||||||
Reference in New Issue
Block a user