Complete the code to call a Supabase function from the client.
const { data, error } = await supabase.rpc('[1]')The client calls the server-side function named getUserProfile to get user data.
Complete the code to handle the server response correctly.
if (error) { console.error([1]) } else { console.log(data) }
When there is an error, error.message contains the error details to log.
Fix the error in the server-side function call to reduce client complexity.
const { data, error } = await supabase.rpc('getUserData', { user_id: [1] })The parameter name must match the server function's expected argument user_id.
Fill both blanks to create a server-side function that returns user info and reduces client logic.
create function getUserInfo([1]) returns json as $$ select * from users where id = [2]; $$ language sql;
The function parameter must be declared as user_id integer and used as user_id in the query to match the argument.
Fill all three blanks to show how server-side logic simplifies client code by handling filtering and sorting.
const { data, error } = await supabase.rpc('getFilteredData', { filter: [1], sortBy: [2], order: [3] })The client sends filter 'active', sorts by 'created_at', and orders descending 'desc'. The server handles the logic, keeping client simple.
