Brought back newsletter form on admin page
This commit is contained in:
@@ -10,16 +10,19 @@ use uuid::Uuid;
|
||||
#[template(path = "../templates/dashboard.html")]
|
||||
struct DashboardTemplate {
|
||||
username: String,
|
||||
idempotency_key: String,
|
||||
idempotency_key_1: String,
|
||||
idempotency_key_2: String,
|
||||
}
|
||||
|
||||
pub async fn admin_dashboard(
|
||||
Extension(AuthenticatedUser { username, .. }): Extension<AuthenticatedUser>,
|
||||
) -> Response {
|
||||
let idempotency_key = Uuid::new_v4().to_string();
|
||||
let idempotency_key_1 = Uuid::new_v4().to_string();
|
||||
let idempotency_key_2 = Uuid::new_v4().to_string();
|
||||
let template = DashboardTemplate {
|
||||
username,
|
||||
idempotency_key,
|
||||
idempotency_key_1,
|
||||
idempotency_key_2,
|
||||
};
|
||||
Html(template.render().unwrap()).into_response()
|
||||
}
|
||||
|
||||
@@ -10,5 +10,6 @@ pub async fn logout(session: TypedSession) -> Result<Response, AdminError> {
|
||||
session.clear().await;
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert("HX-Redirect", "/login".parse().unwrap());
|
||||
Ok((StatusCode::OK, headers).into_response())
|
||||
headers.insert("Location", "/login".parse().unwrap());
|
||||
Ok((StatusCode::SEE_OTHER, headers).into_response())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user