fixing imports and ssr support + updated remix/nextjs/astro examples

This commit is contained in:
dswbx
2024-12-07 19:31:12 +01:00
parent 94cc4042d3
commit 3932396084
40 changed files with 125 additions and 130 deletions

View File

@@ -15,7 +15,7 @@ export const prerender = false;
<Admin
withProvider={{ user }}
config={{ basepath: "/admin", color_scheme: "dark" }}
client:load
client:only
/>
</body>
</html>

View File

@@ -6,7 +6,7 @@ export const ALL = serve({
connection: {
type: "libsql",
config: {
url: "http://127.0.0.1:8080"
url: "file:test.db"
}
}
});

View File

@@ -1,9 +1,20 @@
import { adminPage, getServerSideProps } from "bknd/adapter/nextjs";
import { withApi } from "bknd/adapter/nextjs";
import dynamic from "next/dynamic";
import "bknd/dist/styles.css";
export { getServerSideProps };
export default adminPage({
config: {
basepath: "/admin"
}
const Admin = dynamic(() => import("bknd/ui").then((mod) => mod.Admin), {
ssr: false
});
export const getServerSideProps = withApi(async (context) => {
return {
props: {
user: context.api.getUser()
}
};
});
export default function AdminPage() {
if (typeof document === "undefined") return null;
return <Admin withProvider config={{ basepath: "/admin" }} />;
}

View File

@@ -4,7 +4,7 @@ const handler = serve({
connection: {
type: "libsql",
config: {
url: "http://localhost:8080"
url: "file:test.db"
}
}
});