From 179fd0807b84ff40b8ba9d8357500333adde3a95 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 18 Apr 2024 03:52:16 +0200 Subject: [PATCH] fix(web): cookie auto expires --- web/src/app.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/app.rs b/web/src/app.rs index ae91ae85..e1089b36 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -2,12 +2,18 @@ use leptos::*; use leptos_router::*; use crate::prelude::*; -use leptos_use::{use_cookie, utils::FromToStringCodec}; +use leptos_use::{use_cookie, use_cookie_with_options, utils::FromToStringCodec, UseCookieOptions}; #[component] pub fn App() -> impl IntoView { - let (auth, set_auth) = use_cookie::("token"); + let (auth, set_auth) = use_cookie_with_options::( + "token", + UseCookieOptions::default() + .max_age(1000 * 60 * 60 * 6) + .readonly(false) + .domain(URL_BASE) + ); let (username, set_username) = use_cookie::("username"); provide_context(auth);