fix: use .0 for reading and .1 for writing signals
All checks were successful
Build MIPS Binary / build (push) Successful in 5m20s

This commit is contained in:
spinline
2026-02-09 22:37:06 +03:00
parent 0304c5cb7d
commit 518af10cd7

View File

@@ -15,8 +15,6 @@ pub fn App() -> impl IntoView {
let is_loading = signal(true);
let is_authenticated = signal(false);
let needs_auth_redirect = signal(false);
let needs_setup_redirect = signal(false);
Effect::new(move |_| {
spawn_local(async move {
@@ -27,9 +25,8 @@ pub fn App() -> impl IntoView {
match setup_res {
Ok(status) => {
if !status.completed {
log::info!("Setup not completed, redirecting to /setup");
needs_setup_redirect.set(true);
is_loading.set(false);
log::info!("Setup not completed");
is_loading.1.set(false);
return;
}
}
@@ -48,24 +45,22 @@ pub fn App() -> impl IntoView {
}
}
is_authenticated.set(true);
is_authenticated.1.set(true);
}
Ok(false) => {
log::info!("Not authenticated");
needs_auth_redirect.set(true);
}
Err(e) => {
log::error!("Auth check failed: {:?}", e);
needs_auth_redirect.set(true);
}
}
is_loading.set(false);
is_loading.1.set(false);
});
});
Effect::new(move |_| {
if is_authenticated.get() {
if is_authenticated.0.get() {
spawn_local(async {
gloo_timers::future::TimeoutFuture::new(2000).await;
@@ -81,7 +76,7 @@ pub fn App() -> impl IntoView {
<Router>
<Routes fallback=|| view! { <div class="p-4">"404 Not Found"</div> }>
<Route path=leptos_router::path!("/login") view=move || {
let authenticated = is_authenticated.get();
let authenticated = is_authenticated.0.get();
Effect::new(move |_| {
if authenticated {
@@ -95,7 +90,7 @@ pub fn App() -> impl IntoView {
} />
<Route path=leptos_router::path!("/setup") view=move || {
Effect::new(move |_| {
if is_authenticated.get() {
if is_authenticated.0.get() {
let navigate = use_navigate();
navigate("/", Default::default());
}
@@ -106,7 +101,7 @@ pub fn App() -> impl IntoView {
<Route path=leptos_router::path!("/") view=move || {
Effect::new(move |_| {
if !is_loading.get() && !is_authenticated.get() {
if !is_loading.0.get() && !is_authenticated.0.get() {
log::info!("Not authenticated, redirecting to login");
let navigate = use_navigate();
navigate("/login", Default::default());
@@ -114,12 +109,12 @@ pub fn App() -> impl IntoView {
});
view! {
<Show when=move || !is_loading.get() fallback=|| view! {
<Show when=move || !is_loading.0.get() fallback=|| view! {
<div class="flex items-center justify-center h-screen bg-base-100">
<span class="loading loading-spinner loading-lg"></span>
</div>
}>
<Show when=move || is_authenticated.get() fallback=|| ()>
<Show when=move || is_authenticated.0.get() fallback=|| ()>
<Protected>
<TorrentTable />
</Protected>
@@ -130,15 +125,15 @@ pub fn App() -> impl IntoView {
<Route path=leptos_router::path!("/settings") view=move || {
Effect::new(move |_| {
if !is_authenticated.get() {
if !is_authenticated.0.get() {
let navigate = use_navigate();
navigate("/login", Default::default());
}
});
view! {
<Show when=move || !is_loading.get() fallback=|| ()>
<Show when=move || is_authenticated.get() fallback=|| ()>
<Show when=move || !is_loading.0.get() fallback=|| ()>
<Show when=move || is_authenticated.0.get() fallback=|| ()>
<Protected>
<div class="p-4">"Settings Page (Coming Soon)"</div>
</Protected>