forked from arjunyel/remix-auth-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroot.tsx
46 lines (40 loc) · 1.27 KB
/
root.tsx
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 type { LinksFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import { rootAuthLoader } from "@clerk/remix/ssr.server";
import { ClerkApp, ClerkCatchBoundary } from "@clerk/remix";
import stylesheet from "~/tailwind.css";
export const meta: MetaFunction = () => {
return { title: "Smooth Jazz Remix Stack" };
};
export const links: LinksFunction = () => [{ rel: "stylesheet", href: stylesheet }];
export const loader: LoaderFunction = (args) => {
return rootAuthLoader(
args,
({ request }) => {
const { userId, sessionId, getToken } = request.auth;
console.log("Root loader auth:", { userId, sessionId, getToken });
return { message: `Hello from the root loader :)` };
},
{ loadUser: true }
);
};
function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
}
export default ClerkApp(App);
export const CatchBoundary = ClerkCatchBoundary();