feat : logout callback use current path instead of root

This commit is contained in:
2026-07-08 19:43:01 +07:00 Unverified
parent 79cfbbc737
commit 7dad7ab553
+4 -2
View File
@@ -1,6 +1,7 @@
"use client";
import React, { useState, useMemo } from "react";
import { useState, useMemo } from "react";
import { usePathname } from "next/navigation";
import Image from "next/image";
import { LogOut } from "lucide-react";
import { signOut } from "next-auth/react";
@@ -53,6 +54,7 @@ export function DropdownMenuAvatar({
showName?: boolean;
}) {
const [imgError, setImgError] = useState(false);
const pathname = usePathname();
const displayAvatar = profile?.avatarUrl || userImage;
const displayName = profile?.globalName || userName;
@@ -151,7 +153,7 @@ export function DropdownMenuAvatar({
{/* Footer / Sign Out */}
<div className="p-2 border-t">
<DropdownMenuItem
onClick={() => signOut({ callbackUrl: "/" })}
onClick={() => signOut({ callbackUrl: pathname })}
className="text-destructive"
>
<LogOut className="w-4 h-4 mr-2" />