Make scheduler logout clear session
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { AuthentikLoginButton } from "@scheduler/components/AuthentikLoginButton";
|
||||
import { AuthentikLogoutButton } from "@scheduler/components/AuthentikLogoutButton";
|
||||
import { safeSchedulerCallback } from "@scheduler/lib/scheduler/auth-links";
|
||||
|
||||
type AuthCardProps = {
|
||||
@@ -35,9 +36,7 @@ export function AuthCard({ mode, callbackUrl }: AuthCardProps) {
|
||||
{isLogin ? (
|
||||
<AuthentikLoginButton callbackUrl={safeCallbackUrl} />
|
||||
) : (
|
||||
<Link className="auth-primary" href="/auth/logout">
|
||||
Sign out
|
||||
</Link>
|
||||
<AuthentikLogoutButton />
|
||||
)}
|
||||
{!isLogin && (
|
||||
<Link className="auth-secondary" href="/calendar">
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { signOut } from "next-auth/react";
|
||||
|
||||
export function AuthentikLogoutButton() {
|
||||
return (
|
||||
<button
|
||||
className="auth-primary"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
void signOut({ callbackUrl: "/login" });
|
||||
}}>
|
||||
Sign out
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user