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

rpc: recreate a PostgresClient with proper auth headers #143

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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