diff --git a/docs/content/docs/(documentation)/integration/(frameworks)/nuxt.mdx b/docs/content/docs/(documentation)/integration/(frameworks)/nuxt.mdx index 3cc715d..a96268a 100644 --- a/docs/content/docs/(documentation)/integration/(frameworks)/nuxt.mdx +++ b/docs/content/docs/(documentation)/integration/(frameworks)/nuxt.mdx @@ -189,7 +189,7 @@ export default defineEventHandler(async (event) => { ``` - This can't be done in the `/server/api` directory as it will collide with the API endpoints created by the middleware. We will use [defineEventHandler](https://nuxt.com/docs/4.x/directory-structure/server) in the [/server/routes](https://nuxt.com/docs/4.x/directory-structure/server) directory to create endpoints and use them in conjunction with composables to access the API safely. + This can't be done in the `server/api` directory as it will collide with the API endpoints created by the middleware. We will use [defineEventHandler](https://nuxt.com/docs/4.x/directory-structure/server) in the [server/routes](https://nuxt.com/docs/4.x/directory-structure/server) directory to create endpoints and use them in conjunction with composables to access the API safely. @@ -385,4 +385,18 @@ onMounted(() => { ``` +## Important Note + +Use `external` attribute on Nuxt links, anytime you are traversing to an external route (like `/api/*` which are handled by bknd's middleware) to prevent vue router from intercepting the link. + +```vue + + Admin + +``` + + + If you don't use the `external` attribute, vue router will intercept the link and try to navigate to it, which will fail and result in a 404 error. + + Check the [Nuxt repository example](https://github.com/bknd-io/bknd/tree/main/examples/nuxt) for more implementation details. \ No newline at end of file diff --git a/examples/nuxt/app/assets/css/main.css b/examples/nuxt/app/assets/css/main.css index a88e69a..b0042ae 100644 --- a/examples/nuxt/app/assets/css/main.css +++ b/examples/nuxt/app/assets/css/main.css @@ -1,9 +1,15 @@ -@import "tailwindcss"; +@import url("https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap"); + +.geist-mono-100 { + font-optical-sizing: auto; + font-weight: 100; + font-style: normal; +} :root { --background: #ffffff; --foreground: #171717; - font-weight: 400; + font-family: "Geist Mono", monospace; } @media (prefers-color-scheme: dark) { @@ -14,11 +20,14 @@ } @theme { + --font-sans: var(--font-geist-sans); + --font-mono: var(--font-geist-mono); --color-background: var(--background); --color-foreground: var(--foreground); } body { - @apply bg-background text-foreground; - font-family: Arial, Helvetica, sans-serif; -} + background-color: var(--background); + color: var(--foreground); + font-family: var(--font-geist-mono-100); +} \ No newline at end of file diff --git a/examples/nuxt/app/pages/index.vue b/examples/nuxt/app/pages/index.vue index 9795a16..1c58fb1 100644 --- a/examples/nuxt/app/pages/index.vue +++ b/examples/nuxt/app/pages/index.vue @@ -21,15 +21,15 @@ async function handleSubmit(event: Event) {
-
- Nuxt logo +
+ Nuxt logo
&
bknd logo
-
+

What's next?

-
{{ todo.title }}
@@ -52,8 +55,11 @@ async function handleSubmit(event: Event) {
- +
diff --git a/examples/nuxt/app/pages/user.vue b/examples/nuxt/app/pages/user.vue index 5ac2e27..f277522 100644 --- a/examples/nuxt/app/pages/user.vue +++ b/examples/nuxt/app/pages/user.vue @@ -12,25 +12,31 @@ onMounted(() => {
+ >
-
- Nuxt logo +
+ Nuxt logo
&
- bknd logo + bknd logo
Logged in as {{ data.user.email }}. - + Logout - +

Not logged in. - + Login - +

Sign in with: diff --git a/examples/nuxt/bknd.config.ts b/examples/nuxt/bknd.config.ts index 7a0ba13..3c144c0 100644 --- a/examples/nuxt/bknd.config.ts +++ b/examples/nuxt/bknd.config.ts @@ -54,5 +54,6 @@ export default { adminOptions: { adminBasepath: "/admin", assetsPath: "/admin/", + logoReturnPath: "../..", }, } satisfies NuxtBkndConfig; diff --git a/examples/nuxt/nuxt.config.ts b/examples/nuxt/nuxt.config.ts index a179d24..da89e1f 100644 --- a/examples/nuxt/nuxt.config.ts +++ b/examples/nuxt/nuxt.config.ts @@ -8,4 +8,5 @@ export default defineNuxtConfig({ title: "Nuxt 🤝 Bknd.io", }, }, + css: ["assets/css/main.css"], });