moved almost all deps to dev to speed up installs, updated nextjs docs

This commit is contained in:
dswbx
2024-12-07 08:48:48 +01:00
parent 110c7681b7
commit 44a427de67
5 changed files with 42 additions and 44 deletions

View File

@@ -34,13 +34,26 @@ For more information about the connection object, refer to the [Setup](/setup) g
Create a file `[[...admin]].tsx` inside the `pages/admin` folder:
```tsx
// pages/admin/[[...admin]].tsx
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" }} />;
}
```
## Example usage of the API in pages dir