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,
|
ApplicationStateContext,
|
||||||
ApplicationDispatchContext
|
ApplicationDispatchContext
|
||||||
} from "../../../state/ApplicationContexts";
|
} from "../../../state/ApplicationContexts";
|
||||||
import { get } from "../../../utils/axios";
|
import { readMachines } from "../api";
|
||||||
|
|
||||||
const NetworkContainer = () => {
|
const NetworkContainer = () => {
|
||||||
const state = useContext(ApplicationStateContext);
|
const state = useContext(ApplicationStateContext);
|
||||||
|
@ -15,11 +15,8 @@ const NetworkContainer = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReadMachines = async () => {
|
const handleReadMachines = async () => {
|
||||||
debugger;
|
const machines = await readMachines();
|
||||||
const url = "http://localhost:5064/resurrector-agent/machines";
|
dispatchActions.onNetworkChange("machines", machines);
|
||||||
const machines = await get(url);
|
|
||||||
|
|
||||||
const status = "done";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -15,6 +15,7 @@ export const initialState = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
network: {
|
network: {
|
||||||
|
machines: [],
|
||||||
test: ""
|
test: ""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue