budibase/packages/client/src/api/queries.js

25 lines
476 B
JavaScript
Raw Normal View History

2020-12-30 13:58:39 +01:00
import API from "./api"
/**
* Fetches all rows from a query.
*/
2021-01-06 13:28:51 +01:00
export const fetchQueryData = async ({ _id }) => {
2020-12-30 13:58:39 +01:00
const response = await API.get({
2021-01-06 13:28:51 +01:00
url: `/api/queries/${_id}`,
2020-12-30 13:58:39 +01:00
})
return response.rows
}
/**
* Executes a query against an external data connector.
*/
export const executeQuery = async ({ queryId, params }) => {
const response = await API.post({
url: `/api/queries/${queryId}`,
body: {
params,
},
})
return response.rows
}