import React, { Component, useEffect } from "react"; import ReactDOM from "react-dom"; import { Provider } from "react-redux"; import { createStore } from "redux"; import { compose } from "recompose"; import { initialState, reducers } from "./Store"; import { jhapiRequest } from "./util/jhapiUtil"; import withAPI from "./util/withAPI"; import { HashRouter, Switch, Route, Link } from "react-router-dom"; import ServerDashboard from "./components/ServerDashboard/ServerDashboard"; import Groups from "./components/Groups/Groups"; import GroupEdit from "./components/GroupEdit/GroupEdit"; import CreateGroup from "./components/CreateGroup/CreateGroup"; import AddUser from "./components/AddUser/AddUser"; import EditUser from "./components/EditUser/EditUser"; import "./style/root.css"; const store = createStore(reducers, initialState); const App = (props) => { useEffect(() => { jhapiRequest("/users", "GET") .then((data) => data.json()) .then((data) => store.dispatch({ type: "USER_DATA", value: data })) .catch((err) => console.log(err)); jhapiRequest("/groups", "GET") .then((data) => data.json()) .then((data) => store.dispatch({ type: "GROUPS_DATA", value: data })) .catch((err) => console.log(err)); }); return (
); }; ReactDOM.render(, document.getElementById("react-admin-hook"));