mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-18 14:41:41 +03:00
30 lines
601 B
JavaScript
30 lines
601 B
JavaScript
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>
|
|
<Link to='/editor'> New Article </Link>
|
|
<Link to='/settings'> Settings </Link>
|
|
<Link to={`/@${user.username}`}> { user.username } </Link>
|
|
</div>
|
|
)
|
|
} else {
|
|
return (
|
|
<div>
|
|
<Link to='/signin'> Sign in </Link>
|
|
<Link to='/register'> Sign up </Link>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default Navbar
|