ls-deno/routes/_app.tsx
2022-10-11 17:12:32 -05:00

25 lines
678 B
TypeScript

import { type AppProps, Handlers, PageProps } from "$fresh/server.ts";
import { Page } from "@/components/Page.tsx";
import { type PublicUser } from "@/types.ts";
import { type ContextState } from "@/types.ts";
interface MyAppProps extends AppProps {
user?: PublicUser;
}
export const handler: Handlers<unknown, ContextState> = {
async GET(request: Request, context) {
console.log("AppHandler:", request, context);
return await context.render(context.state.user);
},
};
export default function App({ Component, ...props }: MyAppProps) {
console.log("AppProps:", props);
return (
<Page user={props.user}>
<Component></Component>
</Page>
);
}