read machines and set the result to state
parent
74b397b966
commit
1d71710888
5
.env
5
.env
|
@ -1 +1,4 @@
|
|||
REACT_APP_IDENTITY_AUTHENTICATION_URL=http://localhost:5063/identity/authenticate?UserName={username}&Password={password}
|
||||
#REACT_APP_IDENTITY_AUTHENTICATION_URL=http://localhost:5063/identity/authenticate?UserName={username}&Password={password}
|
||||
|
||||
REACT_APP_IDENTITY_AUTHENTICATION_URL=https://toodle.ddns.net/identity-server-api/identity/authenticate?UserName={username}&Password={password}
|
||||
REACT_APP_NETWORK_RESURRECTOR_API_URL=http://localhost:5064
|
|
@ -0,0 +1,10 @@
|
|||
import { get } from "../../utils/axios";
|
||||
|
||||
const url = `${process.env.REACT_APP_NETWORK_RESURRECTOR_API_URL}/network`;
|
||||
|
||||
const readMachines = () => {
|
||||
const machinesPromise = get(`${url}/machines`);
|
||||
return machinesPromise;
|
||||
};
|
||||
|
||||
export { readMachines };
|
|
@ -4,7 +4,7 @@ import {
|
|||
ApplicationStateContext,
|
||||
ApplicationDispatchContext
|
||||
} from "../../../state/ApplicationContexts";
|
||||
import { get } from "../../../utils/axios";
|
||||
import { readMachines } from "../api";
|
||||
|
||||
const NetworkContainer = () => {
|
||||
const state = useContext(ApplicationStateContext);
|
||||
|
@ -15,11 +15,8 @@ const NetworkContainer = () => {
|
|||
};
|
||||
|
||||
const handleReadMachines = async () => {
|
||||
debugger;
|
||||
const url = "http://localhost:5064/resurrector-agent/machines";
|
||||
const machines = await get(url);
|
||||
|
||||
const status = "done";
|
||||
const machines = await readMachines();
|
||||
dispatchActions.onNetworkChange("machines", machines);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
@ -15,6 +15,7 @@ export const initialState = {
|
|||
}
|
||||
},
|
||||
network: {
|
||||
machines: [],
|
||||
test: ""
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue