mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
moved almost all deps to dev to speed up installs, updated nextjs docs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user