© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
5 replies
KTibow

what's a better way to fetch a single user

right now if i want to fetch a single user i have to use code like this
  const { data, error } = await schoologyUsers.select().eq("email", email);
  if (!data) throw error;
  const user = data[0];
  const { data, error } = await schoologyUsers.select().eq("email", email);
  if (!data) throw error;
  const user = data[0];

however this has some problems
- boilerplatey
- declares
data
data
and
error
error
so i can't use them again
what's a better way to do this? (and yes thankfully this is inside of another reusable function, but i've had to do something like this a couple times)
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Voiding a single user's sessions
SupabaseSSupabase / help-and-questions
4y ago
How to fetch single rows randomly?
SupabaseSSupabase / help-and-questions
4y ago
Linking multiple auth providers to a single user
SupabaseSSupabase / help-and-questions
4y ago
Supabase: How to fetch a user by email?
SupabaseSSupabase / help-and-questions
5mo ago