HX-Redirect to handle redirections with htmx
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
pub mod change_password;
|
||||
pub mod dashboard;
|
||||
pub mod newsletters;
|
||||
mod change_password;
|
||||
mod dashboard;
|
||||
mod logout;
|
||||
mod newsletters;
|
||||
|
||||
use crate::{routes::error_chain_fmt, session_state::TypedSession, templates::ErrorTemplate};
|
||||
use crate::{routes::error_chain_fmt, templates::ErrorTemplate};
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
Json,
|
||||
@@ -10,6 +11,7 @@ use axum::{
|
||||
};
|
||||
pub use change_password::*;
|
||||
pub use dashboard::*;
|
||||
pub use logout::*;
|
||||
pub use newsletters::*;
|
||||
use reqwest::StatusCode;
|
||||
|
||||
@@ -69,9 +71,3 @@ impl IntoResponse for AdminError {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "Logging out", skip(session))]
|
||||
pub async fn logout(session: TypedSession) -> Result<Response, AdminError> {
|
||||
session.clear().await;
|
||||
Ok(Redirect::to("/login").into_response())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user