header button logic
This commit is contained in:
parent
745d58ab3a
commit
040ee2dd05
|
|
@ -4,11 +4,24 @@ import { Button } from "@/components/ui/button";
|
|||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { User, Menu } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import AuthDialog from "@/components/layout/AuthDialog";
|
||||
import useAuthPopup from "@/stores/useAuthPopup";
|
||||
import useAuthStore from "@/stores/useAuthStore";
|
||||
|
||||
export default function Header() {
|
||||
const authPopup = useAuthPopup();
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const handleProfileClick = () => {
|
||||
const token = authStore.getToken();
|
||||
if (token) {
|
||||
router.push("/profile/reservations");
|
||||
} else {
|
||||
authPopup.open();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 bg-white/95 backdrop-blur-sm border-b border-gray-100">
|
||||
|
|
@ -36,7 +49,7 @@ export default function Header() {
|
|||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={authPopup.open}
|
||||
onClick={handleProfileClick}
|
||||
className="text-gray-700 w-[100px] h-[48px] border"
|
||||
>
|
||||
<Menu className="!h-[24px] !w-[24px]" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue