updated examples: astro, nextjs, remix, bun, node

This commit is contained in:
dswbx
2024-12-23 16:50:26 +01:00
parent a17fd2df67
commit 70e42a02d7
31 changed files with 319 additions and 35 deletions

View File

@@ -1,5 +1,7 @@
import { withApi } from "bknd/adapter/nextjs";
import type { InferGetServerSidePropsType } from "next";
import dynamic from "next/dynamic";
import { withApi } from "bknd/adapter/nextjs";
import "bknd/dist/styles.css";
const Admin = dynamic(() => import("bknd/ui").then((mod) => mod.Admin), {
@@ -14,7 +16,11 @@ export const getServerSideProps = withApi(async (context) => {
};
});
export default function AdminPage() {
export default function AdminPage({
user
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
if (typeof document === "undefined") return null;
return <Admin withProvider config={{ basepath: "/admin" }} />;
return (
<Admin withProvider={{ user }} config={{ basepath: "/admin", logo_return_path: "/../" }} />
);
}

View File

@@ -1,7 +1,7 @@
import { serve } from "bknd/adapter/nextjs";
export const config = {
runtime: "experimental-edge",
runtime: "edge",
// add a matcher for bknd dist to allow dynamic otherwise build may fail.
// inside this repo it's '../../app/dist/index.js', outside probably inside node_modules
// see https://github.com/vercel/next.js/issues/51401