Redirects: properly redirect to the current week
Previously, most redirects targeted the root of the application. This was okay for the first part of development where only one week would be active, but would be annoying when using multiple weeks. Change those redirects to call week::week. Change the login path to be dependant on the current week as well, so it can be correctly redirected.
This commit is contained in:
parent
e08a46af3a
commit
a0b79a17ea
6 changed files with 22 additions and 22 deletions
|
@ -22,7 +22,7 @@ pub async fn week(week_number: u8, mut db: Connection<Db>, cookies: &CookieJar<'
|
|||
.fetch_all(&mut **db).await {
|
||||
Ok(v) => v,
|
||||
Err(error) => {
|
||||
println!("Some error while getting players : {error}");
|
||||
error!("Some error while getting players : {error}");
|
||||
Vec::<Player>::new()
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ pub async fn update_week(week: u8, raw_intro: Form<String>,
|
|||
let user = auth::get_user(week, &mut db, cookies).await;
|
||||
if !user.is_admin {
|
||||
cookies.add(("toast_error", "Vous n'avez pas la permission de changer la semaine."));
|
||||
return Redirect::to(uri!("/"));
|
||||
return Redirect::to(uri!(week(week)));
|
||||
}
|
||||
|
||||
let mut options = Options::empty();
|
||||
|
@ -113,7 +113,7 @@ pub async fn update_week(week: u8, raw_intro: Form<String>,
|
|||
}
|
||||
};
|
||||
|
||||
Redirect::to(uri!("/"))
|
||||
Redirect::to(uri!(week(week)))
|
||||
}
|
||||
|
||||
#[post("/<week>/set_last")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue