Remove useless verbs in web api urls
This commit is contained in:
parent
559ed139aa
commit
315626b3ed
7 changed files with 100 additions and 94 deletions
|
|
@ -83,20 +83,32 @@ pub fn main() -> Result<(), JsValue> {
|
|||
// Dark/light theme handling.
|
||||
let toggle_theme: HtmlInputElement = selector("#toggle-theme input");
|
||||
EventListener::new(&toggle_theme.clone(), "change", move |_event| {
|
||||
wasm_cookies::set(
|
||||
common::consts::COOKIE_DARK_THEME,
|
||||
&(!toggle_theme.checked()).to_string(),
|
||||
&wasm_cookies::CookieOptions {
|
||||
path: Some("/"),
|
||||
domain: None,
|
||||
expires: None,
|
||||
secure: false,
|
||||
same_site: wasm_cookies::SameSite::Strict,
|
||||
},
|
||||
);
|
||||
set_cookie_dark_theme(!toggle_theme.checked());
|
||||
window().location().reload().unwrap();
|
||||
})
|
||||
.forget();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `wasm_cookies::set` is specific for the wasm32 target architecture and Rust Analyzer says
|
||||
/// it's an error, it's not possible to configure different target configurations into the same
|
||||
/// workspace. Here is the issue:
|
||||
/// https://users.rust-lang.org/t/can-i-configure-rust-analyzer-vscode-to-use-a-different-target-for-different-crates-in-my-workspce/123661
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn set_cookie_dark_theme(dark_theme: bool) {
|
||||
wasm_cookies::set(
|
||||
common::consts::COOKIE_DARK_THEME,
|
||||
&dark_theme.to_string(),
|
||||
&wasm_cookies::CookieOptions {
|
||||
path: Some("/"),
|
||||
domain: None,
|
||||
expires: None,
|
||||
secure: false,
|
||||
same_site: wasm_cookies::SameSite::Strict,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn set_cookie_dark_theme(_dark_theme: bool) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue