-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Nuxt 3 User Management example #23416
base: master
Are you sure you want to change the base?
Conversation
Updating package versions, as well as .lock file. Adding .env-example file and set runtimeConfig with supabase key
@Shooteger is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
Issue to PR here: #23413 |
@Shooteger , I think the handle_new_user function and the trigger of it are missing too. Could you add it? create function public.handle_new_user()
returns trigger as $$
begin
insert into public.profiles (id, username, avatar_url)
values (new.id, new.raw_user_meta_data->>'username', new.raw_user_meta_data->>'avatar_url');
return new;
end;
$$ language plpgsql security definer;
create trigger on_auth_user_created
after insert on auth.users
for each row execute procedure public.handle_new_user(); |
Hello, generally updated the Readme file now. Much clearer now and links are updated. PLS check @sergor5 |
create function public.handle_new_user() | ||
returns trigger as $$ | ||
begin | ||
insert into public.profiles (id, full_name, avatar_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we are creating the profiles table with an username column and it is a unique one:
create table profiles (
id uuid references auth.users not null primary key,
updated_at timestamp with time zone,
username text unique,
full_name text,
avatar_url text,
website text,
constraint username_length check (char_length(username) >= 3)
);
you probably should update this as:
begin
insert into public.profiles (id, username, full_name, avatar_url)
values (new.id, new.raw_user_meta_data->>'username', new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url');
return new;
end;
$$ language plpgsql security definer;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, the table should already be created in the "Database Schema" step. Remove the create part in the Postgres Row level security" section
|
||
Run the following command to launch it on `localhost:3000` | ||
### 4. Env vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can rename the step sections with a proper number
## Getting Started | ||
|
||
Before running this app, you need to create a Supabase project and copy [your credentials](https://supabase.io/docs/guides/with-nuxt-3#get-the-api-keys) to `.env`. | ||
Iniate a new project in Nuxt 3 with `npx nuxi@latest init <project-name>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After initing the project, the nuxi cli supports auto-installing the modules now as:
npx nuxi module add supabase
so you could make it as the step 2
Updating package versions, as well as .lock file. Adding .env-example file and set runtimeConfig with supabase key
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
It updates the Nuxt 3 User Management example. Newer packages versions to stay accurate, as well as introduce the usage of .env variables.
What is the current behavior?
What is the new behavior?
Additional context