mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-18 22:51:40 +03:00
36 lines
678 B
JavaScript
36 lines
678 B
JavaScript
import React from 'react'
|
|
import { Link } from 'react-router-dom'
|
|
|
|
import useAuth from '@wasp/auth/useAuth.js'
|
|
|
|
const MainPage = () => {
|
|
const { data: user } = useAuth()
|
|
|
|
return (
|
|
<div>
|
|
<UserWidget user={user} />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const UserWidget = (props) => {
|
|
if (props.user) {
|
|
// TODO: Make links lead somewhere.
|
|
return (
|
|
<div>
|
|
<Link to='/settings'> Settings </Link>
|
|
<a href={`/@${props.user.username}`}> { props.user.username } </a>
|
|
</div>
|
|
)
|
|
} else {
|
|
return (
|
|
<div>
|
|
<Link to='/login'> Sign in </Link>
|
|
<Link to='/register'> Sign up </Link>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default MainPage
|