feat: add login and register + add links from primary page
This commit is contained in:
@@ -2,8 +2,11 @@ import logo from '@shared/assets/logo-full-white.png'
|
||||
import styles from './Header.module.css'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { ROUTES } from '@shared/config/routes'
|
||||
import { useIsAuthenticated } from '@features/auth'
|
||||
|
||||
export function Header() {
|
||||
const isAuthenticated = useIsAuthenticated()
|
||||
|
||||
return (
|
||||
<nav className={styles.nav}>
|
||||
<a className={styles.logo} href="/">
|
||||
@@ -13,7 +16,7 @@ export function Header() {
|
||||
<a className={styles.link} href="#about">
|
||||
О нас
|
||||
</a>
|
||||
<Link className={styles.btn} to={ROUTES.WALLET}>
|
||||
<Link className={styles.btn} to={isAuthenticated ? ROUTES.WALLET : ROUTES.LOGIN}>
|
||||
Личный кабинет
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,10 @@ export function useRegisterForm() {
|
||||
|
||||
const completeMutation = useMutation({
|
||||
mutationFn: registrationComplete,
|
||||
onSuccess: () => navigate(ROUTES.LOGIN),
|
||||
onSuccess: () => {
|
||||
localStorage.setItem('isAuthenticated', 'true')
|
||||
navigate(ROUTES.WALLET)
|
||||
},
|
||||
})
|
||||
|
||||
const handleRequestCode = () => {
|
||||
|
||||
Reference in New Issue
Block a user