steid

@jamesgill /

14223e7feat: claim, sign in, and sign out through the browser1mo
1use 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
8use super::context::{claimed, identity};
14223e7feat: claim, sign in, and sign out through the browser1mo
9
a69e380feat: public profile page at /{handle}1mo
10/// The root.
14223e7feat: claim, sign in, and sign out through the browser1mo
11///
a69e380feat: public profile page at /{handle}1mo
12/// Unclaimed, it sends you to `/auth/setup`. Claimed and signed in, it forwards to your
13/// own profile — the profile is the product, so the root is a signpost rather than a
14/// page. Claimed and signed out, it offers a way in; a multi-user instance will want
15/// something better here, but there is nothing to index yet.
14223e7feat: claim, sign in, and sign out through the browser1mo
16#[page("/")]
17async 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}