'use client'; import '../[code]/style.scss'; import { useRouter } from 'next/navigation'; import { useCallback } from 'react'; import useAuth from '@/hooks/useAuth'; export default function PostWriteButton({ alwaysShowButton, boardCode }: { alwaysShowButton: boolean, boardCode: string }) { const router = useRouter(); const { isAuthenticated, isLogined } = useAuth(); const handleClick = useCallback(async (e: React.MouseEvent) => { const redirectUrl = e.currentTarget.value; if (!await isLogined()) { return; } router.push(redirectUrl); }, []); if (!alwaysShowButton && !isAuthenticated) { return; } return ( <>
); }