2020-11-19 17:32:37 +03:00
|
|
|
import React from 'react'
|
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
|
|
|
|
import useAuth from '@wasp/auth/useAuth.js'
|
|
|
|
|
|
|
|
|
|
|
|
const Navbar = () => {
|
|
|
|
const { data: user } = useAuth()
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Link to='/'> Home </Link>
|
2020-11-20 20:22:49 +03:00
|
|
|
<Link to='/editor'> New Article </Link>
|
2020-11-19 17:32:37 +03:00
|
|
|
<Link to='/settings'> Settings </Link>
|
2020-12-01 20:48:39 +03:00
|
|
|
<Link to={`/@${user.username}`}> { user.username } </Link>
|
2020-11-19 17:32:37 +03:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div>
|
2020-12-01 17:19:45 +03:00
|
|
|
<Link to='/signin'> Sign in </Link>
|
2020-11-19 17:32:37 +03:00
|
|
|
<Link to='/register'> Sign up </Link>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Navbar
|