forked from alemi/upub
fix(web): cookie auto expires
This commit is contained in:
parent
0b4b4e7cce
commit
179fd0807b
1 changed files with 8 additions and 2 deletions
|
@ -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::<String, FromToStringCodec>("token");
|
||||
let (auth, set_auth) = use_cookie_with_options::<String, FromToStringCodec>(
|
||||
"token",
|
||||
UseCookieOptions::default()
|
||||
.max_age(1000 * 60 * 60 * 6)
|
||||
.readonly(false)
|
||||
.domain(URL_BASE)
|
||||
);
|
||||
let (username, set_username) = use_cookie::<String, FromToStringCodec>("username");
|
||||
provide_context(auth);
|
||||
|
||||
|
|
Loading…
Reference in a new issue