Refactor MessageTemplate initialization to use Context directly instead of Tr and user parameters
This commit is contained in:
parent
c8e0aa918c
commit
710a134966
4 changed files with 49 additions and 151 deletions
|
|
@ -98,14 +98,7 @@ pub async fn dev_panel(
|
|||
} else {
|
||||
Ok((
|
||||
StatusCode::UNAUTHORIZED,
|
||||
Html(
|
||||
MessageTemplate::new_with_user(
|
||||
consts::NOT_AUTHORIZED_MESSAGE,
|
||||
context.tr,
|
||||
context.user,
|
||||
)
|
||||
.render()?,
|
||||
),
|
||||
Html(MessageTemplate::new(consts::NOT_AUTHORIZED_MESSAGE, context).render()?),
|
||||
)
|
||||
.into_response())
|
||||
}
|
||||
|
|
@ -152,14 +145,7 @@ pub async fn logs(
|
|||
} else {
|
||||
Ok((
|
||||
StatusCode::UNAUTHORIZED,
|
||||
Html(
|
||||
MessageTemplate::new_with_user(
|
||||
consts::NOT_AUTHORIZED_MESSAGE,
|
||||
context.tr,
|
||||
context.user,
|
||||
)
|
||||
.render()?,
|
||||
),
|
||||
Html(MessageTemplate::new(consts::NOT_AUTHORIZED_MESSAGE, context).render()?),
|
||||
)
|
||||
.into_response())
|
||||
}
|
||||
|
|
@ -171,6 +157,6 @@ pub async fn logs(
|
|||
pub async fn not_found(Extension(context): Extension<Context>) -> Result<impl IntoResponse> {
|
||||
Ok((
|
||||
StatusCode::NOT_FOUND,
|
||||
Html(MessageTemplate::new_with_user("404: Not found", context.tr, context.user).render()?),
|
||||
Html(MessageTemplate::new("404: Not found", context).render()?),
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue