Complete the code to call a remote procedure named 'get_user' using Supabase client.
const { data, error } = await supabase.rpc('[1]');The rpc method calls the remote procedure by its exact name. Here, the function is named get_user.
Complete the code to pass a parameter 'user_id' with value 5 to the RPC call.
const { data, error } = await supabase.rpc('get_user', { [1]: 5 });The parameter name must match the expected argument name in the remote procedure. Here, it is user_id.
Fix the error in the code to correctly handle the RPC call result.
if (error) { console.error([1]); } else { console.log(data); }
data instead of error when an error occurs.When an error occurs, you should log the error object, not data.
Fill both blanks to call the RPC function 'update_profile' with parameter 'profile_id' set to 10.
const { data, error } = await supabase.rpc('[1]', { [2]: 10 });The function name is update_profile and the parameter name is profile_id matching the server definition.
Fill all three blanks to call 'delete_item' RPC with 'item_id' 42 and handle error by logging it.
const { data, error } = await supabase.rpc('[1]', { [2]: 42 });
if ([3]) {
console.error(error);
}The RPC function is delete_item, parameter is item_id, and error is checked with error.
