Add redirect to the new interface

This commit is contained in:
Dietrich 2021-07-13 15:59:39 +02:00 committed by Franz Dietrich
parent b9a02b1740
commit 2b276a5130
2 changed files with 11 additions and 1 deletions

View File

@ -166,7 +166,8 @@ pub async fn webservice(
web::post().to(views::get_logged_user_json),
)
.route("/login_user/", web::post().to(views::process_login_json)),
),
)
.default_service(web::to(views::to_admin)),
)
// Serve the Wasm App for the admin interface.
.service(

View File

@ -308,6 +308,15 @@ pub async fn logout(id: Identity) -> Result<HttpResponse, ServerError> {
Ok(redirect_builder("/app/"))
}
#[instrument()]
pub async fn to_admin() -> Result<HttpResponse, ServerError> {
let response = HttpResponse::PermanentRedirect()
.set_header(actix_web::http::header::LOCATION, "/app/")
.body(r#"The admin interface moved to <a href="/app/">/app/</a>"#);
Ok(response)
}
#[instrument()]
pub async fn redirect(
config: web::Data<crate::ServerConfig>,