diff --git a/app/src/infra/cookies.rs b/app/src/infra/cookies.rs index b3840bf..2605c8c 100644 --- a/app/src/infra/cookies.rs +++ b/app/src/infra/cookies.rs @@ -5,8 +5,7 @@ use web_sys::HtmlDocument; fn get_document() -> Result { web_sys::window() - .map(|w| w.document()) - .flatten() + .and_then(|w| w.document()) .ok_or_else(|| anyhow!("Could not get window document")) .and_then(|d| { d.dyn_into::() @@ -16,8 +15,7 @@ fn get_document() -> Result { pub fn set_cookie(cookie_name: &str, value: &str, expiration: &DateTime) -> Result<()> { let doc = web_sys::window() - .map(|w| w.document()) - .flatten() + .and_then(|w| w.document()) .ok_or_else(|| anyhow!("Could not get window document")) .and_then(|d| { d.dyn_into::()