import m, {MithrilComponent} from '@garage44/mithril'
import {Button, Card} from '@garage44/mithril/components'
import {$s} from '@/app'
import {BuildingPicker} from '@/components/elements/buildings/buildings'
import {PlayerSignIn} from '@/components/elements/signin/signin'
import {loadMyBuildings, playerSignOut} from '@/lib/signup'
/**
* Your buildings, for the account that already exists.
*
* The verify screen mounts `BuildingPicker` for the person who signed up a minute
* ago; this page is the way back for everyone else — registered players never
* held a browser session before `/api/login` existed, because the admin login
* refuses them by design. The session lands in `$s.signup`, same slot the
* verification link fills, so the picker itself needs no second variant.
*/
export class Buildings extends MithrilComponent {
oninit() {
// A remembered session: ask the server which buildings it owns. A dead
// token answers 401, `signupApi` clears it, and the form below appears.
if ($s.signup.token) {
void loadMyBuildings()
}
}
view() {
if (!$s.signup.token) {
return (
You're signed in as {$s.signup.username}. Bots and scripts sign in with an access token instead of your password.