Skip to content

Commit 8bc3087

Browse files
chore: converts to POST for queries for unified logs (supabase#36596)
Update QueryOptions.ts Co-authored-by: Joshen Lim <[email protected]>
1 parent 07a0d27 commit 8bc3087

File tree

3 files changed

+12
-35
lines changed

3 files changed

+12
-35
lines changed

apps/studio/data/logs/unified-logs-chart-query.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
22

33
import { getLogsChartQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
4-
import { get, handleError } from 'data/fetchers'
4+
import { handleError, post } from 'data/fetchers'
55
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
66
import { logsKeys } from './keys'
77
import { UNIFIED_LOGS_STALE_TIME, UnifiedLogsVariables } from './unified-logs-infinite-query'
@@ -36,16 +36,9 @@ export async function getUnifiedLogsChart(
3636
// Get SQL query from utility function (with dynamic bucketing)
3737
const sql = getLogsChartQuery(search)
3838

39-
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
40-
params: {
41-
path: { ref: projectRef },
42-
query: {
43-
iso_timestamp_start: dateStart,
44-
iso_timestamp_end: dateEnd,
45-
project: projectRef,
46-
sql,
47-
},
48-
},
39+
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
40+
params: { path: { ref: projectRef } },
41+
body: { sql, iso_timestamp_start: dateStart, iso_timestamp_end: dateEnd },
4942
signal,
5043
})
5144

apps/studio/data/logs/unified-logs-count-query.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
22

33
import { getLogsCountQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
44
import { FacetMetadataSchema } from 'components/interfaces/UnifiedLogs/UnifiedLogs.schema'
5-
import { get, handleError } from 'data/fetchers'
5+
import { handleError, post } from 'data/fetchers'
66
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
77
import { logsKeys } from './keys'
88
import {
@@ -22,17 +22,9 @@ export async function getUnifiedLogsCount(
2222
const sql = getLogsCountQuery(search)
2323
const { isoTimestampStart, isoTimestampEnd } = getUnifiedLogsISOStartEnd(search)
2424

25-
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
26-
params: {
27-
path: { ref: projectRef },
28-
query: {
29-
iso_timestamp_start: isoTimestampStart,
30-
iso_timestamp_end: isoTimestampEnd,
31-
project: projectRef,
32-
sql,
33-
},
34-
},
35-
// body: { sql },
25+
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
26+
params: { path: { ref: projectRef } },
27+
body: { iso_timestamp_start: isoTimestampStart, iso_timestamp_end: isoTimestampEnd, sql },
3628
signal,
3729
})
3830

apps/studio/data/logs/unified-logs-infinite-query.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
PageParam,
66
QuerySearchParamsType,
77
} from 'components/interfaces/UnifiedLogs/UnifiedLogs.types'
8-
import { get, handleError } from 'data/fetchers'
8+
import { handleError, post } from 'data/fetchers'
99
import { ResponseError } from 'types'
1010
import { logsKeys } from './keys'
1111

@@ -77,17 +77,9 @@ async function getUnifiedLogs(
7777
timestampEnd = isoTimestampEnd
7878
}
7979

80-
const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
81-
params: {
82-
path: { ref: projectRef },
83-
query: {
84-
iso_timestamp_start: timestampStart,
85-
iso_timestamp_end: timestampEnd,
86-
project: projectRef,
87-
sql,
88-
},
89-
},
90-
// body: { sql },
80+
const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
81+
params: { path: { ref: projectRef } },
82+
body: { iso_timestamp_start: timestampStart, iso_timestamp_end: timestampEnd, sql },
9183
signal,
9284
})
9385

0 commit comments

Comments
 (0)