Supabase query through Custom Code

Resolved

I have an application where when accessing the profile, I need to check and consult the profile data that needs to be presented.

This is the code for a custom action that has already been tested.

Future<EventsRow?> getNameTest(String profileUser, String loggedUser) async {
  /// MODIFY CODE ONLY BELOW THIS LINE
  final supabase = SupaFlow.client;

  if (profileUser != loggedUser) {
    final response =
        await supabase.from('users').select('*').eq('id', profileUser);
    return response.data;
  }

  final response =
      await supabase.from('users').select('*').eq('id', loggedUser);
  return response.data;

  /// MODIFY CODE ONLY ABOVE THIS LINE
}

However, I need this code to become a custom code, so that it is always executed when loading the profile.

Has anyone managed to solve something like this, please?

1
4 replies