Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update with-nuxt-3.mdx

Richard Scorer43c2bd1a7fcc
diff --git a/web/docs/guides/with-nuxt-3.mdx b/web/docs/guides/with-nuxt-3.mdx
index 9ddebc74dfc..b2de285df01 100644
--- a/web/docs/guides/with-nuxt-3.mdx
+++ b/web/docs/guides/with-nuxt-3.mdx
@@ -188,7 +188,7 @@ Let's set up a Vue component to manage logins and sign ups. We'll use Magic Link
<template>
<form class="row flex flex-center" @submit.prevent="handleLogin">
<div class="col-6 form-widget">
- <h1 class="header">Supabase + Vue 3</h1>
+ <h1 class="header">Supabase + Nuxt 3</h1>
<p class="description">Sign in via magic link with your email below</p>
<div>
<input class="inputField" type="email" placeholder="Your email" v-model="email" />
@@ -242,7 +242,7 @@ Let's create a new component for that called `Account.vue`.
<input id="email" type="text" :value="user.email" disabled />
</div>
<div>
- <label for="username">Name</label>
+ <label for="username">Username</label>
<input id="username" type="text" v-model="username" />
</div>
<div>
@@ -334,6 +334,30 @@ Now that we have all the components in place, let's update `app.vue`:
</template>
```
+We now need to create an index page called `pages/index.vue`:
+
+```html title="pages/index.vue"
+<template>
+ <div class="container" style="padding: 50px 0 100px 0">
+ <Account v-if="user" />
+ <Auth v-else />
+ </div>
+</template>
+
+<script setup>
+
+const supabase = useSupabaseClient()
+
+const user = useUser();
+
+user.value = useSupabaseUser()
+supabase.auth.onAuthStateChange((_, session) => {
+ user.value = session?.user
+})
+
+</script>
+```
+
Once that's done, run this in a terminal window:
```bash
@@ -507,7 +531,7 @@ async function updateProfile() {
async function signOut() {
try {
loading.value = true
- let { error } = await supabase.auth.signOut()
+ let { error } = await `supabase`.auth.signOut()
if (error) throw error
} catch (error) {
alert(error.message)