refactor(routes): re-export is_authenticated for shorter imports

Add pub(crate) re-export of is_authenticated from routes/mod.rs,
allowing handlers to use super::is_authenticated instead of the
verbose crate::application::routes::auth::is_authenticated path.

Updated 9 call sites across roasters.rs, roasts.rs, bags.rs, and
timeline.rs.
This commit is contained in:
Jon Seager 2026-02-02 14:32:30 +00:00
parent 7b0b6409e5
commit 4bae7f1762
No known key found for this signature in database
5 changed files with 11 additions and 18 deletions

View file

@ -77,8 +77,7 @@ pub(crate) async fn bags_page(
let request = query.into_request::<BagSortKey>();
if is_datastar_request(&headers) {
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
return render_bag_list_fragment(state, request, is_authenticated)
.await
.map_err(map_app_error);
@ -100,8 +99,7 @@ pub(crate) async fn bags_page(
.await
.map_err(map_app_error)?;
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = BagsTemplate {
nav_active: "bags",

View file

@ -7,6 +7,8 @@ pub mod support;
pub mod timeline;
pub mod tokens;
pub(crate) use auth::is_authenticated;
use askama::Template;
use axum::http::StatusCode;
use axum::response::{Html, IntoResponse, Redirect};

View file

@ -52,8 +52,7 @@ pub(crate) async fn roasters_page(
let request = query.into_request::<RoasterSortKey>();
if is_datastar_request(&headers) {
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
return render_roaster_list_fragment(state, request, is_authenticated)
.await
.map_err(map_app_error);
@ -63,8 +62,7 @@ pub(crate) async fn roasters_page(
.await
.map_err(map_app_error)?;
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = RoastersTemplate {
nav_active: "roasters",
@ -94,8 +92,7 @@ pub(crate) async fn roaster_page(
.map_err(|err| map_app_error(AppError::from(err)))?;
let roaster_view = RoasterView::from(roaster);
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = RoasterDetailTemplate {
nav_active: "roasters",

View file

@ -55,8 +55,7 @@ pub(crate) async fn roasts_page(
let request = query.into_request::<RoastSortKey>();
if is_datastar_request(&headers) {
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
return render_roast_list_fragment(state, request, is_authenticated)
.await
.map_err(map_app_error);
@ -74,8 +73,7 @@ pub(crate) async fn roasts_page(
.await
.map_err(map_app_error)?;
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = RoastsTemplate {
nav_active: "roasts",
@ -119,8 +117,7 @@ pub(crate) async fn roast_page(
.map(crate::presentation::web::views::BagView::from_domain)
.collect();
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = RoastDetailTemplate {
nav_active: "roasts",

View file

@ -36,8 +36,7 @@ pub(crate) async fn timeline_page(
.await
.map_err(map_app_error)?;
let is_authenticated =
crate::application::routes::auth::is_authenticated(&state, &cookies).await;
let is_authenticated = super::is_authenticated(&state, &cookies).await;
let template = TimelineTemplate {
nav_active: "timeline",