Askama message template
This commit is contained in:
@@ -4,7 +4,7 @@ mod logout;
|
||||
mod newsletters;
|
||||
mod posts;
|
||||
|
||||
use crate::{routes::error_chain_fmt, templates::ErrorTemplate};
|
||||
use crate::{routes::error_chain_fmt, templates::MessageTemplate};
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
Json,
|
||||
@@ -20,7 +20,7 @@ use reqwest::StatusCode;
|
||||
|
||||
#[derive(thiserror::Error)]
|
||||
pub enum AdminError {
|
||||
#[error("Something went wrong.")]
|
||||
#[error("Something went wrong while performing an admin action.")]
|
||||
UnexpectedError(#[from] anyhow::Error),
|
||||
#[error("Trying to access admin dashboard without authentication.")]
|
||||
NotAuthenticated,
|
||||
@@ -62,14 +62,14 @@ impl IntoResponse for AdminError {
|
||||
(StatusCode::SEE_OTHER, headers).into_response()
|
||||
}
|
||||
AdminError::ChangePassword(e) => {
|
||||
let template = ErrorTemplate {
|
||||
error_message: e.to_owned(),
|
||||
let template = MessageTemplate::Error {
|
||||
message: e.to_owned(),
|
||||
};
|
||||
Html(template.render().unwrap()).into_response()
|
||||
}
|
||||
AdminError::Publish(e) => {
|
||||
let template = ErrorTemplate {
|
||||
error_message: e.to_string(),
|
||||
let template = MessageTemplate::Error {
|
||||
message: e.to_string(),
|
||||
};
|
||||
Html(template.render().unwrap()).into_response()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user