-
Notifications
You must be signed in to change notification settings - Fork 2
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
[feat] Uperting profiles to Supabase for onboarding #12
[feat] Uperting profiles to Supabase for onboarding #12
Conversation
app/onboarding/page.tsx
Outdated
import { upsertProfile } from '@/api/supabase/queries/profiles'; | ||
import { Profile } from '@/types/schema'; | ||
|
||
type UUID = `${string}-${string}-${string}-${string}-${string}`; |
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.
we can import the UUID type!
import type { UUID } from 'crypto';
}) => { | ||
return ( | ||
<div> | ||
<h2>Which state do you live in?</h2> |
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.
this will probably be a radio button as well eventually, but this is all right for now!
app/onboarding/page.tsx
Outdated
}; | ||
try { | ||
const updatedProfile = await upsertProfile(profile); | ||
console.log('Profile successfully upserted:', updatedProfile); |
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.
same thing about removing the console log eventually. let's remove this line
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.
looking great so far kevin! main things are
- import UUID from crypto
- remove the email and phone_num fields from the Profile type
- throw errors and remove/comment out console.log's
- we may want to hardcode the user_id to an id of an existing auth user for now.
hooks/useProfile.ts
Outdated
@@ -0,0 +1,31 @@ | |||
import { useState } from 'react'; |
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.
let's remove this file, and it'll be ready to merge!
What's new in this PR 🧑🌾
Description
Added 3 onboarding questions on one page, updates profile and sends to supa base accordingly. The questions added update a profiles state, user_type and has_plot. Removed folders for individual pages in onboarding from previous pr but kept styles.ts.
Screenshots
How to review
checkout supabase/queries/profile.ts for supabase profile upserting and app/onboarding/page.tsx for the unstyled frontend. Run app and go to /onboarding and go through the questions, after pressing submit it should appear on supabase.
Next steps
Adding more functions to the profile query, styling
Relevant links
Online sources
Related PRs
CC: @ccatherinetan