From 5c092e52767e62987ef0294cde1ce40905fc5199 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 25 Aug 2020 21:02:56 +0200 Subject: Use relative URLs for redirects. --- src/controllers/event.rs | 4 ++-- src/controllers/film.rs | 2 +- src/controllers/room.rs | 2 +- src/controllers/screening.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/event.rs b/src/controllers/event.rs index 1b754f2..4de8740 100644 --- a/src/controllers/event.rs +++ b/src/controllers/event.rs @@ -45,7 +45,7 @@ pub fn index(db: db::Connection) -> Result { }, Err(_) => { // Create new event if it's not already in the db. - Err(Redirect::to("/new")) + Err(Redirect::to("new")) } } } @@ -64,5 +64,5 @@ pub struct NewEventForm { #[post("/", format = "application/x-www-form-urlencoded", data = "
")] pub fn create(db: db::Connection, form: Form) -> Result> { models::Event::create(&db, &form.name, &form.description)?; - Ok(Redirect::to("/")) + Ok(Redirect::to("")) } diff --git a/src/controllers/film.rs b/src/controllers/film.rs index 70a6042..f407a4b 100644 --- a/src/controllers/film.rs +++ b/src/controllers/film.rs @@ -64,5 +64,5 @@ pub struct NewFilmForm { #[post("/", format = "application/x-www-form-urlencoded", data = "")] pub fn create_film(db: db::Connection, film: Form) -> Result> { db.create_film(&film.title, &film.url)?; - Ok(Redirect::to("/films")) + Ok(Redirect::to("films")) } diff --git a/src/controllers/room.rs b/src/controllers/room.rs index 6458f86..9a4f4c2 100644 --- a/src/controllers/room.rs +++ b/src/controllers/room.rs @@ -63,5 +63,5 @@ pub struct NewRoomForm { #[post("/", format = "application/x-www-form-urlencoded", data = "")] pub fn create_room(db: db::Connection, room: Form) -> Result> { db.create_room(&room.name)?; - Ok(Redirect::to("/rooms")) + Ok(Redirect::to("rooms")) } diff --git a/src/controllers/screening.rs b/src/controllers/screening.rs index cf7d1b1..06b0b84 100644 --- a/src/controllers/screening.rs +++ b/src/controllers/screening.rs @@ -93,7 +93,7 @@ pub fn create_screening(db: db::Connection, screening: Form) - start_time, end_time)?; - Ok(Redirect::to("/screenings")) + Ok(Redirect::to("screenings")) } #[get("/")] @@ -140,7 +140,7 @@ pub fn update(db: db::Connection, screening: Form) -> Result< start_time, end_time)?; - Ok(Redirect::to("/screenings")) + Ok(Redirect::to("screenings")) } #[derive(FromForm)] @@ -151,5 +151,5 @@ pub struct DeleteScreeningForm { #[delete("/", format = "application/x-www-form-urlencoded", data = "")] pub fn delete(db: db::Connection, screening: Form) -> Result> { db.delete_screening(screening.screening_id)?; - Ok(Redirect::to("/screenings")) + Ok(Redirect::to("screenings")) } -- cgit v1.2.3