diff --git a/web-frontend/src/main/v3/packages/constants/src/EndPoints.ts b/web-frontend/src/main/v3/packages/constants/src/EndPoints.ts index a721a4affa1e..e5597d0fe4e9 100644 --- a/web-frontend/src/main/v3/packages/constants/src/EndPoints.ts +++ b/web-frontend/src/main/v3/packages/constants/src/EndPoints.ts @@ -52,8 +52,8 @@ export const ALARM_RULE = `${LOCAL_API_PATH}/application/alarmRule`; // export const = '/getApplicationStat/directBuffer/chart'; // export const = '/admin/removeAgentId'; // export const = '/admin/removeInactiveAgents'; -export const ADMIN_REMOVE_APPLICATION = '/admin/removeApplicationName'; -export const ADMIN_REMOVE_AGENT = '/admin/removeAgentId'; +export const ADMIN_REMOVE_APPLICATION = `${LOCAL_API_PATH}/admin/removeApplicationName`; +export const ADMIN_REMOVE_AGENT = `${LOCAL_API_PATH}/admin/removeAgentId`; export const BIND = `${LOCAL_API_PATH}/bind`; // export const = '/getAgentStat/uriStat/chartList'; diff --git a/web-frontend/src/main/v3/packages/hooks/src/api/useAdmin.ts b/web-frontend/src/main/v3/packages/hooks/src/api/useAdmin.ts index 44398dc5b0b0..2bef14ddabd7 100644 --- a/web-frontend/src/main/v3/packages/hooks/src/api/useAdmin.ts +++ b/web-frontend/src/main/v3/packages/hooks/src/api/useAdmin.ts @@ -1,19 +1,20 @@ import { useMutation, UseMutationOptions } from '@tanstack/react-query'; import { END_POINTS } from '@pinpoint-fe/constants'; -type Response = { - result: 'SUCCESS'; +type deleteApplicationParams = { + applicationName: string; + password: string; }; export const useDeleteApplication = ( - options?: UseMutationOptions, + options?: UseMutationOptions, ) => { - const deleteApplication = async (applicationName: string) => { + const deleteApplication = async (params: deleteApplicationParams) => { try { const response = await fetch( - `${END_POINTS.ADMIN_REMOVE_APPLICATION}?applicationName=${applicationName}`, + `${END_POINTS.ADMIN_REMOVE_APPLICATION}?applicationName=${params?.applicationName}&password=${params?.password}`, { - method: 'DELETE', + method: 'GET', headers: { 'Content-Type': 'application/json', }, @@ -25,9 +26,7 @@ export const useDeleteApplication = ( throw new Error(errorData?.message); } - const data = await response.json(); - - return data; + return null; } catch (error) { throw error; } @@ -42,17 +41,18 @@ export const useDeleteApplication = ( type deleteAgentParams = { applicationName: string; agentId: string; + password: string; }; export const useDeleteAgent = ( - options?: UseMutationOptions, + options?: UseMutationOptions, ) => { const deleteAgent = async (params: deleteAgentParams) => { try { const response = await fetch( - `${END_POINTS.ADMIN_REMOVE_AGENT}?applicationName=${params?.applicationName}&agentId=${params?.agentId}`, + `${END_POINTS.ADMIN_REMOVE_AGENT}?applicationName=${params?.applicationName}&agentId=${params?.agentId}&password=${params?.password}`, { - method: 'DELETE', + method: 'GET', headers: { 'Content-Type': 'application/json', }, @@ -64,9 +64,7 @@ export const useDeleteAgent = ( throw new Error(errorData?.message); } - const data = await response.json(); - - return data; + return null; } catch (error) { throw error; } diff --git a/web-frontend/src/main/v3/packages/ui/src/components/Config/agentManagement/AgentManagementFetcher.tsx b/web-frontend/src/main/v3/packages/ui/src/components/Config/agentManagement/AgentManagementFetcher.tsx index 9b5044a5c3f3..e0c2c603a75f 100644 --- a/web-frontend/src/main/v3/packages/ui/src/components/Config/agentManagement/AgentManagementFetcher.tsx +++ b/web-frontend/src/main/v3/packages/ui/src/components/Config/agentManagement/AgentManagementFetcher.tsx @@ -65,13 +65,18 @@ export const AgentManagementFetcher = ({ configuration }: AgentManagementFetcher }, [data]); function handleRemoveApplication(removeApplication?: ApplicationType) { - deleteApplication(removeApplication?.applicationName || ''); + deleteApplication({ + applicationName: removeApplication?.applicationName || '', + password: '', + }); } function handleRemoveAgent(removeAgent?: SearchApplication.Instance) { + console.log('removeAgent', removeAgent, 'application', application); deleteAgent({ - applicationName: application?.applicationName || '', + applicationName: removeAgent?.applicationName || '', agentId: removeAgent?.agentId || '', + password: '', }); }