diff --git a/src/tera/log.rs b/src/tera/log.rs index dbdd518..91433bc 100644 --- a/src/tera/log.rs +++ b/src/tera/log.rs @@ -78,22 +78,21 @@ async fn show_kiosk(db: &State, _kios: KioskCookie) -> Template { Template::render("log.completed", context!(logs)) } -#[get("/kiosk/ekrv2019")] -fn new_kiosk(cookies: &CookieJar<'_>) -> Redirect { - let mut cookie = Cookie::new("kiosk", "yes".to_string()); +#[get("/kiosk/ekrv2019/")] +fn new_kiosk(cookies: &CookieJar<'_>, loc: String) -> Redirect { + let mut cookie = Cookie::new("kiosk", loc); cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12)); cookies.add_private(cookie); - Redirect::to("/log/Linz") + Redirect::to("/log") } -#[get("/")] +#[get("/")] async fn kiosk( db: &State, flash: Option>, - _kiosk: KioskCookie, - loc: String, + kiosk: KioskCookie, ) -> Template { - let boats = Boat::all_at_location(db, loc).await; + let boats = Boat::all_at_location(db, kiosk.0).await; let coxes = User::cox(db).await; let users = User::all(db).await; let logtypes = LogType::all(db).await; @@ -246,7 +245,7 @@ mod test { let response = req.dispatch().await; assert_eq!(response.status(), Status::SeeOther); - assert_eq!(response.headers().get("Location").next(), Some("/log/Linz")); + assert_eq!(response.headers().get("Location").next(), Some("/log")); let req = client.get("/log"); let response = req.dispatch().await;