read machines and set the result to state

master
Tudor Stanciu 2021-04-16 00:55:18 +03:00
parent 74b397b966
commit 1d71710888
4 changed files with 18 additions and 7 deletions

5
.env
View File

@ -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

View File

@ -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 };

View File

@ -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 (

View File

@ -15,6 +15,7 @@ export const initialState = {
}
},
network: {
machines: [],
test: ""
}
};