Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Sep 6, 2023
1 parent a1325e5 commit 84cf510
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/NoPoolType/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ anyhow = "1.0.71"
serde = "1.0.167"

[dependencies.axum_session]
version = "0.3.0"
version = "0.5.0"
features = ["sqlite-rustls"]

[dependencies.axum_session_auth]
Expand Down
6 changes: 3 additions & 3 deletions examples/NoPoolType/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type NullPool = Arc<Option<()>>;

#[async_trait]
impl Authentication<User, i64, NullPool> for User {
async fn load_user(userid: i64, pool: Option<&NullPool>) -> Result<User, anyhow::Error> {
async fn load_user(userid: i64, _pool: Option<&NullPool>) -> Result<User, anyhow::Error> {
if userid == 1 {
Ok(User::default())
} else {
Expand Down Expand Up @@ -80,13 +80,13 @@ async fn main() {
//To enable Private cookies for integrity, and authenticity please check the next Example.
let session_config = SessionConfig::default().with_table_name("test_table");
let auth_config = AuthConfig::<i64>::default().with_anonymous_user_id(Some(1));

// create SessionStore and initiate the database tables
let session_store =
SessionStore::<SessionSqlitePool>::new(Some(pool.clone().into()), session_config)
.await
.unwrap();

//Create the Database table for storing our Session Data.
session_store.initiate().await.unwrap();
let nullpool = Arc::new(Option::None);

// build our application with some routes
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlx-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ anyhow = "1.0.71"
serde = "1.0.167"

[dependencies.axum_session]
version = "0.3.0"
version = "0.5.0"
features = ["sqlite-rustls"]

[dependencies.axum_session_auth]
Expand Down
4 changes: 2 additions & 2 deletions examples/sqlx-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ async fn main() {
//To enable Private cookies for integrity, and authenticity please check the next Example.
let session_config = SessionConfig::default().with_table_name("test_table");
let auth_config = AuthConfig::<i64>::default().with_anonymous_user_id(Some(1));

// create SessionStore and initiate the database tables
let session_store =
SessionStore::<SessionSqlitePool>::new(Some(pool.clone().into()), session_config)
.await
.unwrap();

//Create the Database table for storing our Session Data.
session_store.initiate().await.unwrap();
User::create_user_tables(&pool).await;

// build our application with some routes
Expand Down

0 comments on commit 84cf510

Please sign in to comment.