Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #143 from cgestes/main
Browse files Browse the repository at this point in the history
rpc: recreate a PostgresClient with proper auth headers
  • Loading branch information
dshukertjr committed Sep 24, 2022
2 parents e872088 + 227dbb1 commit 63ee064
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/src/supabase_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ class SupabaseClient {
headers: headers,
);
realtime = _initRealtimeClient(headers: headers);
rest = PostgrestClient(
'$supabaseUrl/rest/v1',
headers: headers,
schema: schema,
httpClient: _httpClient,
);

_listenForAuthEvents();
}
Expand Down Expand Up @@ -88,7 +82,12 @@ class SupabaseClient {

/// Perform a stored procedure call.
PostgrestFilterBuilder rpc(String fn, {Map<String, dynamic>? params}) {
return rest.rpc(fn, params: params);
return PostgrestClient(
'$supabaseUrl/rest/v1',
headers: _getAuthHeaders(),
schema: schema,
httpClient: _httpClient,
).rpc(fn, params: params);
}

/// Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
Expand Down

0 comments on commit 63ee064

Please sign in to comment.