Remove iso timestamp start and end from audit log resource key

This commit is contained in:
Joshen Lim committed 2023-07-04 12:34:16 +08:00
1 parent faa5a28a4b
commit 2ccb94552c
2 files changed
+6 -13

No files matched your search

+1 -7
View File
@@ -7,13 +7,7 @@ export const organizationKeys = {
['organizations', slug, 'free-project-limit-check'] as const,
customerProfile: (slug: string | undefined) =>
['organizations', slug, 'customer-profile'] as const,
auditLogs: (
slug: string | undefined,
{
iso_timestamp_start,
iso_timestamp_end,
}: { iso_timestamp_start: string | undefined; iso_timestamp_end: string | undefined }
) => ['organizations', slug, 'audit-logs', { iso_timestamp_start, iso_timestamp_end }] as const,
auditLogs: (slug: string | undefined) => ['organizations', slug, 'audit-logs'] as const,
migrateBilling: (slug: string | undefined) => ['organizations', slug, 'migrate-billing'] as const,
migrateBillingPreview: (slug: string | undefined) =>
['organizations', slug, 'migrate-billing', 'preview'] as const,
@@ -68,9 +68,9 @@ export const useOrganizationAuditLogsQuery = <TData = OrganizationAuditLogsData>
...options
}: UseQueryOptions<OrganizationAuditLogsData, OrganizationAuditLogsError, TData> = {}
) => {
const { slug, iso_timestamp_start, iso_timestamp_end } = vars
const { slug } = vars
return useQuery<OrganizationAuditLogsData, OrganizationAuditLogsError, TData>(
organizationKeys.auditLogs(slug, { iso_timestamp_start, iso_timestamp_end }),
organizationKeys.auditLogs(slug),
({ signal }) => getOrganizationAuditLogs(vars, signal),
{
enabled: enabled && typeof slug !== 'undefined',
@@ -82,14 +82,13 @@ export const useOrganizationAuditLogsQuery = <TData = OrganizationAuditLogsData>
}
export const useOrganizationAuditLogsPrefetch = (vars: OrganizationAuditLogsVariables) => {
const { slug, iso_timestamp_start, iso_timestamp_end } = vars
const { slug } = vars
const client = useQueryClient()
return useCallback(() => {
if (slug) {
client.prefetchQuery(
organizationKeys.auditLogs(slug, { iso_timestamp_start, iso_timestamp_end }),
({ signal }) => getOrganizationAuditLogs(vars, signal)
client.prefetchQuery(organizationKeys.auditLogs(slug), ({ signal }) =>
getOrganizationAuditLogs(vars, signal)
)
}
// eslint-disable-next-line react-hooks/exhaustive-deps