Handle redirections (#8)

* feat: support axum permanent redirect

* feat: lowercase route names

* feat: allow redirection on client side routing

* doc: update tutorial

* refactor: update useListenBrowserUrlUpdates hook

* refactor: moved initRouterStore to useRouterStore file

* feat: update version to v0.3.0

* fix: types
This commit is contained in:
Valerio Ageno
2024-06-29 11:58:04 +02:00
committed by GitHub
parent 7401a59346
commit b6d0bb13ef
16 changed files with 219 additions and 72 deletions
+1
View File
@@ -37,6 +37,7 @@ export default function IndexPage({
</div>
</div>
<ul style={{ flexWrap: 'wrap', display: 'flex', gap: 10 }}>
<PokemonLink pokemon={{ name: 'GOAT' }} id={0} />
{data.results.map((pokemon, i) => {
return <PokemonLink pokemon={pokemon} id={i + 1} key={i} />
})}
@@ -0,0 +1,7 @@
// src/routes/pokemons/GOAT.rs
use tuono_lib::{Request, Response};
#[tuono_lib::handler]
async fn redirect_to_goat(_: Request<'_>, _: reqwest::Client) -> Response {
Response::Redirect("/pokemons/mewtwo".to_string())
}