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

23 lines
448 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.
*/
2021-01-06 13:28:51 +01:00
export const executeQuery = async ({ _id }) => {
const response = await API.post({
2021-01-06 13:28:51 +01:00
url: `/api/queries/${_id}`,
// body: params,
})
return response.rows
}