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

22 lines
634 B
JavaScript
Raw Normal View History

import { get } from "../../utils/axios";
2021-04-17 03:21:43 +03:00
const apiUrl = `${process.env.REACT_APP_NETWORK_RESURRECTOR_API_URL}/network`;
const serverUrl = `${process.env.REACT_APP_NETWORK_RESURRECTOR_SERVER_URL}/resurrector`;
const readMachines = () => {
2021-04-17 03:21:43 +03:00
const machinesPromise = get(`${apiUrl}/machines`);
return machinesPromise;
};
2021-04-17 03:21:43 +03:00
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 };