network-resurrector/src/features/machines/api.js

22 lines
634 B
JavaScript

import { get } from "../../utils/axios";
const apiUrl = `${process.env.REACT_APP_NETWORK_RESURRECTOR_API_URL}/network`;
const serverUrl = `${process.env.REACT_APP_NETWORK_RESURRECTOR_SERVER_URL}/resurrector`;
const readMachines = () => {
const machinesPromise = get(`${apiUrl}/machines`);
return machinesPromise;
};
const wakeMachine = macAddress => {
const promise = get(`${serverUrl}/wake`, { macAddress });
return promise;
};
const pingMachine = ipAddressOrMachineName => {
const promise = get(`${serverUrl}/ping`, { ipAddressOrMachineName });
return promise;
};
export { readMachines, wakeMachine, pingMachine };