Skip to content

Commit

Permalink
feat: authenticated user client will expose user struct
Browse files Browse the repository at this point in the history
  • Loading branch information
roberts-pumpurs committed Sep 22, 2024
1 parent 867d39b commit 0205fb1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/supabase-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a> Stream for RefreshStream<'a> {

#[allow(
clippy::too_many_lines,
reason = "poll funcions tend to become like this"
reason = "poll functions tend to become like this"
)]
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let mut this = self.project();
Expand Down
3 changes: 3 additions & 0 deletions crates/supabase-client/src/client/authenticated.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use std::sync::Arc;

use supabase_auth::User;
use tokio::sync::RwLock;
use tokio::task::JoinHandle;

#[derive(Debug)]
pub struct AuthenticatedSupabaseClient {
pub(crate) token_refresh: JoinHandle<()>,
pub(crate) supabase_url: url::Url,
pub(crate) client: Arc<RwLock<reqwest::Client>>,
pub user: User,
}

impl Drop for AuthenticatedSupabaseClient {
Expand Down
1 change: 1 addition & 0 deletions crates/supabase-client/src/client/unauthenticated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl SupabaseClient {
supabase_url: self.supabase_url,
client,
token_refresh: handle,
user: auth_resp.user,
})
}
}

0 comments on commit 0205fb1

Please sign in to comment.