fix: resolve auth flow and DB schema issues

Fix column name mismatches, enhance signup UX, and align DB schema with codebase.

Co-authored-by: Moheeb Zara <[email protected]>
This commit is contained in:
v0
2026-03-11 06:17:13 +00:00
co-authored by Moheeb Zara
parent e90e39dbbb
commit 0f71ddf377
2 changed files with 47 additions and 27 deletions
+14
View File
@@ -107,12 +107,26 @@ export default function SignupPage() {
if (authError) { setError(authError.message); setLoading(false); return }
// If Supabase returns a session immediately it means email confirmation is
// disabled — the user is fully signed up AND signed in in one step.
// We still need to create the space/member record via the server action.
if (authData.session) {
// User is now authenticated — create the space or join via server action
const result = mode === 'create'
? await createSpace({ spaceName, spaceSlug, spaceCity, displayName: fullName })
: await joinSpace({ inviteCode, displayName: fullName })
if (result.error) {
setError(result.error)
setLoading(false)
return
}
router.push('/dashboard')
router.refresh()
return
}
// Email confirmation is required — redirect to the confirm page
router.push('/signup/confirm?email=' + encodeURIComponent(email))
}