Merge remote-tracking branch 'origin/main' into 22-create-home-page-2
This commit is contained in:
15
src/app.rs
15
src/app.rs
@ -6,6 +6,7 @@ use leptos_meta::*;
|
||||
use leptos_router::*;
|
||||
use crate::pages::login::*;
|
||||
use crate::pages::signup::*;
|
||||
use crate::error_template::{AppError, ErrorTemplate};
|
||||
|
||||
|
||||
#[component]
|
||||
@ -22,11 +23,17 @@ pub fn App() -> impl IntoView {
|
||||
<Title text="LibreTunes"/>
|
||||
|
||||
// content for this welcome page
|
||||
<Router>
|
||||
<Router fallback=|| {
|
||||
let mut outside_errors = Errors::default();
|
||||
outside_errors.insert_with_default_key(AppError::NotFound);
|
||||
view! {
|
||||
<ErrorTemplate outside_errors/>
|
||||
}
|
||||
.into_view()
|
||||
}>
|
||||
<main>
|
||||
<Routes>
|
||||
<Route path="" view=HomePage/>
|
||||
<Route path="/*any" view=NotFound/>
|
||||
<Route path="/login" view=Login />
|
||||
<Route path="/signup" view=Signup />
|
||||
</Routes>
|
||||
@ -77,8 +84,8 @@ fn NotFound() -> impl IntoView {
|
||||
{
|
||||
// this can be done inline because it's synchronous
|
||||
// if it were async, we'd use a server function
|
||||
let resp = expect_context::<leptos_actix::ResponseOptions>();
|
||||
resp.set_status(actix_web::http::StatusCode::NOT_FOUND);
|
||||
let resp = expect_context::<leptos_axum::ResponseOptions>();
|
||||
resp.set_status(axum::http::StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
view! {
|
||||
|
Reference in New Issue
Block a user