import type { LoaderFunctionArgs } from "@remix-run/node";
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from "@remix-run/react";
import { withApi } from "bknd/adapter/remix";
import { type Api, ClientProvider } from "bknd/client";
export function Layout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
declare module "@remix-run/server-runtime" {
export interface AppLoadContext {
api: Api;
}
}
export const loader = withApi(async (args: LoaderFunctionArgs, api: Api) => {
return {
user: api.getUser()
};
});
export default function App() {
const data = useLoaderData();
// add user to the client provider to indicate
// that you're authed using cookie
return (
);
}