- Wire up deleting a series. - Add an error boundary for better error handling from the server function. Suspense and bounday expect the child to be an option or a result respectively not a view itself. Took a while to figure that out.
54 lines
1.6 KiB
Rust
54 lines
1.6 KiB
Rust
use self::{
|
|
home::HomePage,
|
|
series::{add::AddSeries, view::ViewSeries},
|
|
};
|
|
use crate::error_template::{AppError, ErrorTemplate};
|
|
use leptos::*;
|
|
use leptos_meta::*;
|
|
use leptos_router::*;
|
|
|
|
mod home;
|
|
mod series;
|
|
|
|
#[component]
|
|
pub fn App() -> impl IntoView {
|
|
// Provides context that manages stylesheets, titles, meta tags, etc.
|
|
provide_meta_context();
|
|
|
|
view! {
|
|
|
|
|
|
// injects a stylesheet into the document <head>
|
|
// id=leptos means cargo-leptos will hot-reload this stylesheet
|
|
<Stylesheet id="leptos" href="/pkg/watch.css"/>
|
|
<Link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
|
rel="stylesheet"
|
|
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
|
crossorigin="anonymous"
|
|
/>
|
|
|
|
// sets the document title
|
|
<Title text="Watch"/>
|
|
|
|
// content for this welcome page
|
|
<Router fallback=|| {
|
|
let mut outside_errors = Errors::default();
|
|
outside_errors.insert_with_default_key(AppError::NotFound);
|
|
view! {
|
|
<ErrorTemplate outside_errors/>
|
|
}
|
|
.into_view()
|
|
}>
|
|
<h1 class="mb-5 text-bg-primary p-5">"What We're Watching"</h1>
|
|
<main class="container">
|
|
<Routes>
|
|
<Route path="" view=HomePage>
|
|
<Route path="add" view=AddSeries />
|
|
<Route path="view/:id" view=ViewSeries />
|
|
<Route path="" view=|| () />
|
|
</Route>
|
|
</Routes>
|
|
</main>
|
|
</Router>
|
|
}
|
|
}
|