generated from psb/melange-opam-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.re
43 lines (39 loc) · 1.07 KB
/
Index.re
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
type root;
[@bs.module "react-dom/client"]
external createRoot: Dom.element => root = "createRoot";
[@bs.send] external render: (root, React.element) => unit = "render";
[@bs.val] [@bs.scope ("window", "location")]
external origin: string = "origin";
module Auth0Provider = {
type auth_param = {redirect_uri: string};
[@bs.module "@auth0/auth0-react"] [@react.component]
external make:
(
~domain: string,
~clientId: string,
~authorizationParams: auth_param,
~children: React.element
) =>
React.element =
"Auth0Provider";
};
ReactDOM.querySelector("#root")
->(
fun
| Some(root) => {
let app = createRoot(root);
render(
app,
<Auth0Provider
domain="dev-dj37pygvjwvaxjde.us.auth0.com"
clientId="e6mvq0WBov5jSBW0clTFdAIXgbyyK4gv"
authorizationParams={redirect_uri: origin ++ "/profile"}>
<App />
</Auth0Provider>,
);
}
| None =>
Js.Console.error(
"Failed to start React: couldn't find the #root element",
)
);