add auth, logout

This commit is contained in:
smanylov
2025-11-28 15:28:15 +07:00
parent 5c1a60645f
commit c4ece25c61
6 changed files with 125 additions and 34 deletions
+16 -6
View File
@@ -6,6 +6,7 @@ import clsx from 'clsx';
import styles from './ui.module.scss'
import Logo from '@/app/ui/logo';
import DropDownList from '@/app/ui/nav-link-dropdown';
import { logout } from '@/app/actions/auth';
const links = [
{
@@ -42,12 +43,7 @@ const links = [
name: 'API',
href: '/pages/page1',
img: 'M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z'
},
{
name: 'Выход',
href: '/pages/page1',
img: 'M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z'
},
}
];
export default function NavLinks() {
@@ -95,6 +91,20 @@ export default function NavLinks() {
</Link>
);
})}
<Link
key='Выход'
href='/login'
className={`flex ${styles['nav-link']}`}
onClick={(e) => {
e.preventDefault();
logout();
}}
>
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"></path>
</svg>
<p className="hidden md:block">Выход</p>
</Link>
</ul>
</nav>
</div>