'use client' import React from 'react' import Link from 'next/link' import Image from 'next/image' import Button from './ui/Button' import useUserStore from '@/app/store/userStore' const UserLogin = () => { const { isAuthenticated, user } = useUserStore() const isUserAuth = isAuthenticated && user // определяем отображаемое имя и путь для редиректа const getDisplayNameAndPath = () => { if (isUserAuth) { return { name: user?.name || 'пользователь', path: '/account', } } return { name: 'Зарегистрироваться', path: '/register', } } const { name, path } = getDisplayNameAndPath() if (!isUserAuth) { return ( <>
Регистрация / Войти
user
) } return (