fleet/frontend/services/entities/device_user.ts

31 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-03-21 13:38:59 +00:00
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { IDeviceUserResponse, IHostDevice } from "interfaces/host";
2022-03-21 13:38:59 +00:00
import sendRequest from "services";
import endpoints from "utilities/endpoints";
2022-03-21 13:38:59 +00:00
export type ILoadHostDetailsExtension = "device_mapping" | "macadmins";
export default {
loadHostDetails: (deviceAuthToken: string): Promise<IDeviceUserResponse> => {
2022-03-21 13:38:59 +00:00
const { DEVICE_USER_DETAILS } = endpoints;
const path = `${DEVICE_USER_DETAILS}/${deviceAuthToken}`;
return sendRequest("GET", path);
},
loadHostDetailsExtension: (
deviceAuthToken: string,
extension: ILoadHostDetailsExtension
) => {
const { DEVICE_USER_DETAILS } = endpoints;
const path = `${DEVICE_USER_DETAILS}/${deviceAuthToken}/${extension}`;
return sendRequest("GET", path);
},
refetch: (deviceAuthToken: string) => {
const { DEVICE_USER_DETAILS } = endpoints;
const path = `${DEVICE_USER_DETAILS}/${deviceAuthToken}/refetch`;
return sendRequest("POST", path);
},
};