File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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() {
2020export 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+ }
Original file line number Diff line number Diff line change 11import { redirect } from "next/navigation" ;
22
3+ import { signOutFromKeycloak } from "@/app/actions" ;
34import { getSession } from "@/lib/auth" ;
45
56export 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}
You can’t perform that action at this time.
0 commit comments