make redirect from '/'
This commit is contained in:
parent
513518215d
commit
9fc4dde550
13
src/lib.rs
13
src/lib.rs
@ -18,7 +18,13 @@ i18n!("locales", fallback = "de-AT");
|
|||||||
|
|
||||||
use admin::station::Station;
|
use admin::station::Station;
|
||||||
use auth::Backend;
|
use auth::Backend;
|
||||||
use axum::{body::Body, extract::FromRef, response::Response, routing::get, Router};
|
use axum::{
|
||||||
|
body::Body,
|
||||||
|
extract::FromRef,
|
||||||
|
response::{IntoResponse, Redirect, Response},
|
||||||
|
routing::get,
|
||||||
|
Router,
|
||||||
|
};
|
||||||
use axum_login::AuthManagerLayerBuilder;
|
use axum_login::AuthManagerLayerBuilder;
|
||||||
use partials::page;
|
use partials::page;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
@ -148,6 +154,10 @@ async fn logo_ver_inv() -> Response<Body> {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn redirect() -> impl IntoResponse {
|
||||||
|
Redirect::to("/admin")
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct AppState {
|
struct AppState {
|
||||||
db: Arc<SqlitePool>,
|
db: Arc<SqlitePool>,
|
||||||
@ -172,6 +182,7 @@ fn router(db: SqlitePool) -> Router {
|
|||||||
let state = AppState { db: Arc::new(db) };
|
let state = AppState { db: Arc::new(db) };
|
||||||
|
|
||||||
Router::new()
|
Router::new()
|
||||||
|
.route("/", get(redirect))
|
||||||
.nest("/s/{id}/{code}", station::routes()) // TODO: maybe switch to "/"
|
.nest("/s/{id}/{code}", station::routes()) // TODO: maybe switch to "/"
|
||||||
.nest("/admin", admin::routes())
|
.nest("/admin", admin::routes())
|
||||||
.nest("/auth", auth::routes())
|
.nest("/auth", auth::routes())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user