feat: event management and websocket for updates
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use axum_extra::extract::cookie::CookieJar;
|
||||
use leptos::{prelude::*, server_fn::error::NoCustomError};
|
||||
use leptos_axum::{extract, ResponseOptions};
|
||||
use pbkdf2::{
|
||||
@@ -196,15 +197,10 @@ pub async fn destroy_auth_session() -> Result<(), ServerFnError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_auth_session() -> Result<Option<User>, ServerFnError> {
|
||||
use axum_extra::extract::cookie::CookieJar;
|
||||
|
||||
println!("In get auth session");
|
||||
let owner = leptos::prelude::Owner::current().unwrap();
|
||||
|
||||
let db = crate::db::get_db()?;
|
||||
let jar = extract::<CookieJar>().await?;
|
||||
|
||||
pub async fn get_auth_session_inner(
|
||||
db: SqlitePool,
|
||||
jar: CookieJar
|
||||
) -> Result<Option<User>, crate::error::Error> {
|
||||
let Some(cookie) = jar.get(SESSION_ID_KEY) else {
|
||||
return Ok(None);
|
||||
};
|
||||
@@ -252,3 +248,12 @@ pub async fn get_auth_session() -> Result<Option<User>, ServerFnError> {
|
||||
|
||||
Ok(user)
|
||||
}
|
||||
|
||||
pub async fn get_auth_session() -> Result<Option<User>, ServerFnError> {
|
||||
let db = crate::db::get_db()?;
|
||||
let jar = extract::<CookieJar>().await?;
|
||||
|
||||
get_auth_session_inner(db, jar)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user