Identity type: —
This is the code that displays the Hello section above.
import { zing } from "~/zing/zingCore";
// "Hello, world!" when nobody is authenticated; otherwise the
// identity's name (with a friendly fallback if the name field is
// not exposed to this site).
function render() {
const user = zing.user;
const name = !user ? "world" : (user.identity.name ?? "friend");
elGreeting.textContent = `Hello, ${name}!`;
}
// Re-render on every SDK state change.
zing.subscribe(render);
Want to build your site on this template? Three steps:
git clone https://bitbucket.org/kesteinbakk/hello-demo.git)
and cd hello-demo/typescript.
.env.local
as VITE_SITE_ID.
pnpm dev,
or deploy to any static host (Vercel, Netlify, Cloudflare Pages).