14223e7feat: claim, sign in, and sign out through the browser1mo | 1 | use topcoat::{ |
| 2 | Result, |
| 3 | context::Cx, |
| 4 | router::{error::redirect, page}, |
| 5 | view::view, |
| 6 | }; |
| 7 | |
40ab5c7feat: /api/me and a shared identity read model1mo | 8 | use super::context::{claimed, identity}; |
14223e7feat: claim, sign in, and sign out through the browser1mo | 9 | |
a69e380feat: public profile page at /{handle}1mo | 10 | |
14223e7feat: claim, sign in, and sign out through the browser1mo | 11 | |
a69e380feat: public profile page at /{handle}1mo | 12 | |
| 13 | |
| 14 | |
| 15 | |
14223e7feat: claim, sign in, and sign out through the browser1mo | 16 | #[page("/")] |
| 17 | async fn home(cx: &Cx) -> Result { |
| 18 | if !claimed(cx).await? { |
aaefaabfeat: root handles, grouped routes, reserved-handle denylist1mo | 19 | return Err(redirect("/auth/setup").into()); |
14223e7feat: claim, sign in, and sign out through the browser1mo | 20 | } |
| 21 | |
a69e380feat: public profile page at /{handle}1mo | 22 | if let Some(identity) = identity(cx).await? { |
| 23 | return Err(redirect(&format!("/{}", identity.handle)).into()); |
| 24 | } |
| 25 | |
14223e7feat: claim, sign in, and sign out through the browser1mo | 26 | view! { |
| 27 | <h1>"steid"</h1> |
a69e380feat: public profile page at /{handle}1mo | 28 | <p><a href="/auth/login">"Sign in"</a></p> |
14223e7feat: claim, sign in, and sign out through the browser1mo | 29 | } |
| 30 | } |