Add logout button

This commit is contained in:
Jon Staab
2026-03-26 14:38:21 -07:00
parent f46f6043d3
commit 2ba5d519e1
3 changed files with 22 additions and 3 deletions
+1
View File
@@ -6,6 +6,7 @@ The account page lets an authenticated tenant manage billing settings and review
page(path="/account", auth="required", shell="app")
header
title My Account
button Log out
section(id="status")
heading Account Status
+19 -1
View File
@@ -1,10 +1,13 @@
import { createEffect, createMemo, createResource, createSignal, For, Show } from "solid-js"
import { useNavigate } from "@solidjs/router"
import { getTenant, listTenantInvoices, updateTenantBilling } from "../lib/api"
import PageContainer from "../components/PageContainer"
import LoadingState from "../components/LoadingState"
import useMinLoading from "../components/useMinLoading"
import { accounts, persistAccounts } from "../lib/nostr"
export default function Account() {
const navigate = useNavigate()
const [tenant, { refetch: refetchTenant }] = createResource(getTenant)
const [invoices] = createResource(listTenantInvoices)
const [nwcUrl, setNwcUrl] = createSignal("")
@@ -36,9 +39,24 @@ export default function Account() {
}
}
function logout() {
accounts.clearActive()
persistAccounts()
navigate("/")
}
return (
<PageContainer>
<h1 class="text-2xl font-bold text-gray-900 mb-6 py-2">My Account</h1>
<div class="mb-6 py-2 flex items-center justify-between gap-3">
<h1 class="text-2xl font-bold text-gray-900">My Account</h1>
<button
type="button"
onClick={logout}
class="py-1.5 px-3 border border-gray-300 text-gray-700 text-sm rounded-lg hover:bg-gray-50 transition-colors"
>
Log out
</button>
</div>
<div class="space-y-6">
<section class="bg-white border border-gray-200 rounded-xl p-6">
+2 -2
View File
@@ -37,7 +37,7 @@ export default function Home() {
href={account() ? "/relays" : "/login"}
class="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors"
>
{account() ? "Dashboard" : "Sign in"}
{account() ? "Go to dashboard" : "Sign in"}
</A>
</div>
</nav>
@@ -76,7 +76,7 @@ export default function Home() {
href={account() ? "/relays" : "/login"}
class="inline-flex items-center gap-2 py-3 px-8 border border-gray-200 text-gray-700 font-semibold rounded-xl hover:bg-gray-50 transition-all"
>
{account() ? "Dashboard" : "Sign in"}
{account() ? "Go to dashboard" : "Sign in"}
</A>
</div>
</div>