feat: add customer authentication and order dashboard

This commit is contained in:
2026-09-16 09:06:48 +03:30
parent f49ef11c9c
commit 7c55b3916c
31 changed files with 2193 additions and 53 deletions
+19
View File
@@ -0,0 +1,19 @@
'use client';
import type {MouseEvent, ReactNode} from 'react';
import Link from 'next/link';
import {useRouter} from 'next/navigation';
import {useAuth} from '@/app/context/AuthContext';
export default function ProtectedLink({href, children, className, onClick}: {href: string; children: ReactNode; className?: string; onClick?: () => void}) {
const auth = useAuth();
const router = useRouter();
const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {
onClick?.();
if (!auth.isAuthenticated) {
event.preventDefault();
auth.openLogin(() => router.push(href));
}
};
return <Link href={href} className={className} onClick={handleClick}>{children}</Link>;
}