diff options
Diffstat (limited to '')
-rw-r--r-- | src/public/pages.rs (renamed from src/api/pages.rs) | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/api/pages.rs b/src/public/pages.rs index 4ed2e49..1614d81 100644 --- a/src/api/pages.rs +++ b/src/public/pages.rs @@ -5,7 +5,7 @@ use axum::{ }; use crate::{ - console, + public::console, types::{ extract::{AuthorizedUser, Log}, http::ResponseCode, @@ -24,32 +24,20 @@ async fn login(user: Option<AuthorizedUser>, _: Log) -> Response { if user.is_some() { Redirect::to("/home").into_response() } else { - ResponseCode::Success.file("/login.html").await + super::serve("/login.html").await } } -async fn home(user: Option<AuthorizedUser>, _: Log) -> Response { - if user.is_none() { - Redirect::to("/login").into_response() - } else { - ResponseCode::Success.file("/home.html").await - } +async fn home(_: Log) -> Response { + super::serve("/home.html").await } -async fn people(user: Option<AuthorizedUser>, _: Log) -> Response { - if user.is_none() { - Redirect::to("/login").into_response() - } else { - ResponseCode::Success.file("/people.html").await - } +async fn people(_: Log) -> Response { + super::serve("/people.html").await } -async fn profile(user: Option<AuthorizedUser>, _: Log) -> Response { - if user.is_none() { - Redirect::to("/login").into_response() - } else { - ResponseCode::Success.file("/profile.html").await - } +async fn profile(_: Log) -> Response { + super::serve("/profile.html").await } async fn console() -> Response { @@ -57,7 +45,7 @@ async fn console() -> Response { } async fn admin() -> Response { - ResponseCode::Success.file("/admin.html").await + super::serve("/admin.html").await } async fn wordpress(_: Log) -> Response { |