chore: converts to POST for queries for unified logs (#36596)

Update QueryOptions.ts

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
Jonathan Summers-MuirandJoshen Lim authored and GitHub committed 2025-06-24 17:30:04 +08:00
1 parent 07a0d279ea
commit 8bc3087a11
3 files changed
+12 -35

No files matched your search

@@ -1,7 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { getLogsChartQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
import { get, handleError } from 'data/fetchers'
import { handleError, post } from 'data/fetchers'
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
import { logsKeys } from './keys'
import { UNIFIED_LOGS_STALE_TIME, UnifiedLogsVariables } from './unified-logs-infinite-query'
@@ -36,16 +36,9 @@ export async function getUnifiedLogsChart(
// Get SQL query from utility function (with dynamic bucketing)
const sql = getLogsChartQuery(search)
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: {
path: { ref: projectRef },
query: {
iso_timestamp_start: dateStart,
iso_timestamp_end: dateEnd,
project: projectRef,
sql,
},
},
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: { path: { ref: projectRef } },
body: { sql, iso_timestamp_start: dateStart, iso_timestamp_end: dateEnd },
signal,
})
@@ -2,7 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { getLogsCountQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
import { FacetMetadataSchema } from 'components/interfaces/UnifiedLogs/UnifiedLogs.schema'
import { get, handleError } from 'data/fetchers'
import { handleError, post } from 'data/fetchers'
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
import { logsKeys } from './keys'
import {
@@ -22,17 +22,9 @@ export async function getUnifiedLogsCount(
const sql = getLogsCountQuery(search)
const { isoTimestampStart, isoTimestampEnd } = getUnifiedLogsISOStartEnd(search)
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: {
path: { ref: projectRef },
query: {
iso_timestamp_start: isoTimestampStart,
iso_timestamp_end: isoTimestampEnd,
project: projectRef,
sql,
},
},
// body: { sql },
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: { path: { ref: projectRef } },
body: { iso_timestamp_start: isoTimestampStart, iso_timestamp_end: isoTimestampEnd, sql },
signal,
})
@@ -5,7 +5,7 @@ import {
PageParam,
QuerySearchParamsType,
} from 'components/interfaces/UnifiedLogs/UnifiedLogs.types'
import { get, handleError } from 'data/fetchers'
import { handleError, post } from 'data/fetchers'
import { ResponseError } from 'types'
import { logsKeys } from './keys'
@@ -77,17 +77,9 @@ async function getUnifiedLogs(
timestampEnd = isoTimestampEnd
}
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: {
path: { ref: projectRef },
query: {
iso_timestamp_start: timestampStart,
iso_timestamp_end: timestampEnd,
project: projectRef,
sql,
},
},
// body: { sql },
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
params: { path: { ref: projectRef } },
body: { iso_timestamp_start: timestampStart, iso_timestamp_end: timestampEnd, sql },
signal,
})