17 lines
455 B
Rust
17 lines
455 B
Rust
use rocket::{get, response::Redirect};
|
|
|
|
use crate::routes::authentication::Authenticated;
|
|
use crate::{utils, utils::Theme};
|
|
|
|
/// Set the user-interface theme according to the query parameter value.
|
|
#[get("/theme?<theme>")]
|
|
pub fn set_theme(_auth: Authenticated, theme: &str) -> Redirect {
|
|
match theme {
|
|
"light" => utils::set_theme(Theme::Light),
|
|
"dark" => utils::set_theme(Theme::Dark),
|
|
_ => (),
|
|
}
|
|
|
|
Redirect::to("/")
|
|
}
|