16 lines
609 B
JavaScript
16 lines
609 B
JavaScript
import path from "path";
|
|
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
|
import grabAPIBasePath from "../../utils/grab-api-base-path";
|
|
export default async function apiCrudGET({ dbName, tableName, query, targetId, apiKey, }) {
|
|
const basePath = grabAPIBasePath({ paradigm: "crud" });
|
|
const finalID = typeof targetId === "number" ? String(targetId) : targetId;
|
|
const finalPath = path.join(basePath, dbName, tableName, finalID || "");
|
|
const GET_RES = await queryDSQLAPI({
|
|
method: "GET",
|
|
path: finalPath,
|
|
query,
|
|
apiKey,
|
|
});
|
|
return GET_RES;
|
|
}
|