use combined endpoint for android (#37562)

fix a bug that the frontend wasn't changed to use the shared mdm
unenroll endpoint
This commit is contained in:
Magnus Jensen 2025-12-19 15:55:53 -04:00 committed by GitHub
parent 7c16c3b9fc
commit 3d14b1c962
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 15 deletions

View file

@ -40,11 +40,7 @@ const UnenrollMdmModal = ({
const submitUnenrollMdm = async () => {
setRequestState("unenrolling");
try {
if (isAndroid(hostPlatform)) {
await mdmAPI.unenrollAndroidHostFromMdm(hostId, 5000);
} else {
await mdmAPI.unenrollHostFromMdm(hostId, 5000);
}
await mdmAPI.unenrollHostFromMdm(hostId, 5000);
const successMessage =
isIPadOrIPhone(hostPlatform) || isAndroid(hostPlatform) ? (
<>

View file

@ -102,20 +102,15 @@ export type IGetBootstrapPackageSummaryResponse = IBootstrapPackageAggregate;
const mdmService = {
unenrollHostFromMdm: (hostId: number, timeout?: number) => {
const { HOST_MDM_UNENROLL } = endpoints;
const { HOST_MDM } = endpoints;
return sendRequest(
"PATCH",
HOST_MDM_UNENROLL(hostId),
"DELETE",
HOST_MDM(hostId),
undefined,
undefined,
timeout
);
},
// Android-specific: admin-initiated unenroll uses POST /api/_version_/fleet/hosts/{id}/mdm/unenroll
unenrollAndroidHostFromMdm: (hostId: number, timeout?: number) => {
const path = `${endpoints.HOST_MDM(hostId)}/unenroll`;
return sendRequest("POST", path, undefined, undefined, timeout);
},
requestCSR: () => {
const { MDM_REQUEST_CSR } = endpoints;

View file

@ -181,8 +181,6 @@ export default {
MDM_EULA_UPLOAD: `/${API_VERSION}/fleet/mdm/setup/eula`,
MDM_EULA_METADATA: `/${API_VERSION}/fleet/mdm/setup/eula/metadata`,
HOST_MDM: (id: number) => `/${API_VERSION}/fleet/hosts/${id}/mdm`,
HOST_MDM_UNENROLL: (id: number) =>
`/${API_VERSION}/fleet/mdm/hosts/${id}/unenroll`,
HOST_ENCRYPTION_KEY: (id: number) =>
`/${API_VERSION}/fleet/hosts/${id}/encryption_key`,