fix(http): get time series data properly
parent
fcb930e19b
commit
3b400952d9
|
@ -50,10 +50,11 @@ interface GetTimeSeriesResult {
|
|||
|
||||
export const getTimeSeries = async (
|
||||
url: string, // query URI
|
||||
script: string
|
||||
query: string
|
||||
): Promise<GetTimeSeriesResult> => {
|
||||
let responseBody: string
|
||||
let responseByteLength: number
|
||||
const type = 'flux'
|
||||
|
||||
try {
|
||||
// We are using the `fetch` API here since the `AJAX` utility lacks support
|
||||
|
@ -64,7 +65,7 @@ export const getTimeSeries = async (
|
|||
// https://github.com/axios/axios/issues/1491.
|
||||
const resp = await fetch(url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({script}),
|
||||
body: JSON.stringify({query, type}),
|
||||
})
|
||||
|
||||
const {body, byteLength} = await decodeFluxRespWithLimit(resp)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
query "github.com/desa/platform/query/builtin"
|
||||
query "github.com/influxdata/platform/query/builtin"
|
||||
"github.com/influxdata/platform/query/parser"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue