2022-10-11 17:02:45 -05:00
|
|
|
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> = {
|
2022-10-11 17:12:32 -05:00
|
|
|
async GET(request: Request, context) {
|
|
|
|
console.log("AppHandler:", request, context);
|
2022-10-11 17:02:45 -05:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
}
|