Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Reuse the AuditLog type.

Ivan Vasilov2a921544a936
diff --git a/studio/data/organizations/organization-audit-logs-query.ts b/studio/data/organizations/organization-audit-logs-query.ts
index 8b5663dd6c2..abd43dd4b04 100644
--- a/studio/data/organizations/organization-audit-logs-query.ts
+++ b/studio/data/organizations/organization-audit-logs-query.ts
@@ -1,12 +1,13 @@
import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'
+import dayjs from 'dayjs'
+import { useCallback } from 'react'
+
import { get } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
-import { useCallback } from 'react'
-import { organizationKeys } from './keys'
import { ResponseError } from 'types'
-import dayjs from 'dayjs'
+import { organizationKeys } from './keys'
-export type OrganizationAuditLog = {
+export type AuditLog = {
action: {
metadata: {
method?: string
diff --git a/studio/data/profile/profile-audit-logs-query.ts b/studio/data/profile/profile-audit-logs-query.ts
index 9e7b3ae6101..44d5f5a1143 100644
--- a/studio/data/profile/profile-audit-logs-query.ts
+++ b/studio/data/profile/profile-audit-logs-query.ts
@@ -1,6 +1,8 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
-import { get } from 'data/fetchers'
import dayjs from 'dayjs'
+
+import { get } from 'data/fetchers'
+import { AuditLog } from 'data/organizations/organization-audit-logs-query'
import { ResponseError } from 'types'
import { profileKeys } from './keys'
@@ -24,11 +26,14 @@ export async function getProfileAuditLogs(
})
if (error) throw error
- return data
+ return data as unknown as ProfileAuditLogsData
}
-export type ProfileAuditLogsData = Awaited<ReturnType<typeof getProfileAuditLogs>>
export type ProfileAuditLogsError = ResponseError
+export type ProfileAuditLogsData = {
+ result: AuditLog[]
+ retention_period: number
+}
export const useProfileAuditLogsQuery = <TData = ProfileAuditLogsData>(
vars: ProfileAuditLogsVariables,