Fleet UI: Replace mock API call with autofill API call (#18705)

This commit is contained in:
RachelElysia 2024-05-02 12:40:02 -04:00 committed by Victor Lyuboslavsky
parent b670df9447
commit b864130fe9
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,4 @@
// import sendRequest from "services";
import { sendRequest } from "services/mock_service/service/service";
import sendRequest from "services";
import endpoints from "utilities/endpoints";
export type IAutofillPolicy = {
@ -9,8 +8,11 @@ export type IAutofillPolicy = {
export default {
getPolicyInterpretationFromSQL: (sql: string): Promise<IAutofillPolicy> => {
const { AUTOFILL_POLICIES } = endpoints;
const { AUTOFILL_POLICY } = endpoints;
return sendRequest("POST", AUTOFILL_POLICIES, sql);
// API expects JSON object with key "sql"
const data = JSON.stringify({ sql });
return sendRequest("POST", AUTOFILL_POLICY, data);
},
};

View file

@ -130,7 +130,7 @@ export default {
`/${API_VERSION}/fleet/software/versions/${id}`,
// AI endpoints
AUTOFILL_POLICIES: `/${API_VERSION}/fleet/autofill/policies`,
AUTOFILL_POLICY: `/${API_VERSION}/fleet/autofill/policy`,
SSO: `/v1/fleet/sso`,
STATUS_LABEL_COUNTS: `/${API_VERSION}/fleet/host_summary`,