Skip to content

Commit f02e307

Browse files
dcl10claude
andcommitted
Add sign-out action and button to dashboard placeholder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7167995 commit f02e307

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

frontend/app/actions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use server";
22

3-
import { signIn } from "@/auth";
3+
import { signIn, signOut } from "@/auth";
44

55
/**
66
* Initiates the Keycloak OAuth flow via a server action.
@@ -20,3 +20,8 @@ export async function signInWithKeycloak() {
2020
export async function signUpWithKeycloak() {
2121
await signIn("keycloak", { redirectTo: "/dashboard" }, { prompt: "create" });
2222
}
23+
24+
/** Signs the user out and redirects to the landing page. */
25+
export async function signOutFromKeycloak() {
26+
await signOut({ redirectTo: "/" });
27+
}

frontend/app/dashboard/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { redirect } from "next/navigation";
22

3+
import { signOutFromKeycloak } from "@/app/actions";
34
import { getSession } from "@/lib/auth";
45

56
export default async function DashboardPage() {
@@ -11,9 +12,17 @@ export default async function DashboardPage() {
1112
<h1 className="text-3xl font-bold tracking-[-0.025em] text-ink mb-3">
1213
Your project dashboard
1314
</h1>
14-
<p className="text-[15px] text-ink-soft">
15+
<p className="text-[15px] text-ink-soft mb-8">
1516
Dashboard functionality coming soon.
1617
</p>
18+
<form action={signOutFromKeycloak}>
19+
<button
20+
type="submit"
21+
className="inline-flex items-center gap-2 font-sans font-medium tracking-[-0.005em] rounded-sm px-[16px] py-[9px] text-[14px] bg-paper text-ink border border-[var(--border-strong)] hover:bg-portland-stone transition-colors duration-[120ms] cursor-pointer"
22+
>
23+
Sign out
24+
</button>
25+
</form>
1726
</main>
1827
);
1928
}

0 commit comments

Comments
 (0)