forked from SLFullStackers/SpringAngularWebSocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
38 lines (36 loc) · 1.03 KB
/
App.tsx
File metadata and controls
38 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { useEffect, useState } from "react";
import { Admin, DataProvider, Resource } from "react-admin";
import buildGraphQLProvider from "./data-provider/graphqlDataProvider";
import { theme } from "./theme/theme";
import Login from "./Login";
import "./App.scss";
import Dashboard from "./pages/Dashboard";
import { jwtAuthProvider } from "./auth-provider/ra-auth-jwt";
const App = (): React.ReactElement => {
const [dataProvider, setDataProvider] = useState<DataProvider | null>(null);
useEffect(() => {
buildGraphQLProvider
.then((provider: any) => {
setDataProvider(() => provider);
})
.catch((error: any) => {
console.log(error);
});
}, []);
if (!dataProvider) {
return <div>Loading</div>;
}
return (
<div className="App">
<Admin
title={"My App Manager"}
dataProvider={dataProvider}
authProvider={jwtAuthProvider}
theme={theme}
dashboard={Dashboard}
loginPage={Login}
></Admin>
</div>
);
};
export default App;