-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
46 lines (41 loc) · 1.34 KB
/
index.js
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
39
40
41
42
43
44
45
46
import React, { StrictMode } from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { MoralisProvider } from "react-moralis";
import "./index.css";
import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
import QuickStart from "components/QuickStart";
/** Get your free Moralis Account https://moralis.io/ */
const APP_ID = process.env.REACT_APP_MORALIS_APPLICATION_ID;
const SERVER_URL = process.env.REACT_APP_MORALIS_SERVER_URL;
const Application = () => {
const isServerInfo = APP_ID && SERVER_URL ? true : false;
//Validate
if (!APP_ID || !SERVER_URL)
throw new Error(
"Missing Moralis Application ID or Server URL. Make sure to set your .env file.",
);
if (isServerInfo)
return (
<MoralisProvider appId={APP_ID} serverUrl={SERVER_URL}>
<App isServerInfo />
</MoralisProvider>
);
else {
return (
<div style={{ display: "flex", justifyContent: "center" }}>
<QuickStart />
</div>
);
}
};
ReactDOM.render(
<StrictMode>
<Application />
</StrictMode>,
document.getElementById("root"),
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.register();