use leptos::prelude::*;
use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title};
use leptos_router::{
components::{A, ParentRoute, Route, Router, Routes},
hooks::use_query_map,
path
};
use crate::users::User;
#[server]
pub async fn test_retrieve() -> Result {
use leptos::server_fn::error::NoCustomError;
tokio::time::sleep(tokio::time::Duration::from_millis(1000)).await;
let start = std::time::SystemTime::now();
let since_the_epoch = start
.duration_since(std::time::UNIX_EPOCH)
.map_err(|e| ServerFnError::::ServerError(e.to_string()))?
.as_secs();
Ok(since_the_epoch)
}
#[server]
pub async fn me() -> Result
}/>
}
}
#[component]
fn LoginPage(login: ServerAction) -> impl IntoView {
let next = move || use_query_map().read().get("next").unwrap_or("/".to_string());
view! {
{move || match login.value().get() {
Some(Ok(_)) => None,
None => None,
Some(Err(e)) => Some(view! {
"Error signing in: "
{format!("{e:?}")}
})
}}
}
}
/// Renders the home page of your application.
#[component]
fn HomePage() -> impl IntoView {
view! {
"Welcome to sparse!"
"To get started:"
- "Sign in"
- "Go to beacon management"
- "Create a listener"
- "(Optional) Create a category"
- "Create a template"
- "Download the installer"
- "Run the installer on a target system"
}
}