mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-04 00:56:01 +00:00
updated nextjs example
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { getApi } from "@/bknd";
|
||||
import { Buttons, List } from "../layout";
|
||||
|
||||
export default async function SSRPage() {
|
||||
const api = await getApi({ verify: true });
|
||||
const { data } = await api.data.readMany("todos");
|
||||
const user = api.getUser();
|
||||
|
||||
return (
|
||||
<>
|
||||
<List items={data.map((todo) => todo.title)} />
|
||||
<Buttons />
|
||||
|
||||
<p>
|
||||
{user ? (
|
||||
<>
|
||||
Logged in as {user.email}.{" "}
|
||||
<a className="font-medium underline" href="/api/auth/logout">
|
||||
Logout
|
||||
</a>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Not logged in.{" "}
|
||||
<a className="font-medium underline" href="/admin/auth/login">
|
||||
Login
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user