Remove unused 'title' variable from base template

This commit is contained in:
Matthew Gordon 2024-03-02 20:39:01 -04:00
parent 3d4a34611b
commit 7f7277da2d
3 changed files with 6 additions and 14 deletions

View File

@ -19,10 +19,8 @@ pub fn routes<D: Database>() -> Router<AppState<D>> {
#[derive(Template)]
#[template(path = "index.html")]
struct IndexTemplate<'a> {
title: &'a str,
}
struct IndexTemplate {}
async fn root<'a>() -> IndexTemplate<'a> {
IndexTemplate { title: "Locality" }
async fn root() -> IndexTemplate {
IndexTemplate {}
}

View File

@ -130,20 +130,14 @@ impl std::error::Error for Error {
#[derive(Template)]
#[template(path = "error.html")]
struct ErrorTemplate<'a> {
title: &'a str,
}
struct ErrorTemplate {}
impl IntoResponse for Error {
fn into_response(self) -> Response {
match self.error_type {
ErrorType::InternalServerError => {
error!(inner = self.inner, "Uncaught error producing HTTP 500.");
(
StatusCode::INTERNAL_SERVER_ERROR,
ErrorTemplate { title: "Error" },
)
.into_response()
(StatusCode::INTERNAL_SERVER_ERROR, ErrorTemplate {}).into_response()
}
ErrorType::Unauthorized => {
(StatusCode::UNAUTHORIZED, "User not authorized.").into_response()

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>{% block title %}{{title}} - Locality{% endblock %}</title>
<title>{% block title %}Locality{% endblock %}</title>
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16.png">