forked from polka_billy/porridger
Added sign out button to user page
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
import { Container } from 'react-bootstrap'
|
||||
|
||||
import BackHeader from '../components/BackHeader'
|
||||
import { useUser } from '../hooks/api'
|
||||
import { userCategories } from '../assets/userCategories'
|
||||
import { CategoryPreview, Points } from '../components'
|
||||
import { BackHeader, CategoryPreview, Points, SignOut } from '../components'
|
||||
import { gotError } from '../hooks/useFetch'
|
||||
|
||||
function UserPage() {
|
||||
@ -12,11 +11,16 @@ function UserPage() {
|
||||
return (
|
||||
<Container style={{ maxWidth: 'calc(100vh*9/16)' }}>
|
||||
<BackHeader text={
|
||||
gotError(user) ?
|
||||
user.error :
|
||||
gotError(user) ? (
|
||||
user.error
|
||||
) : (
|
||||
`${user.data.name}, с нами с ${new Date(user.data.regDate).toLocaleDateString('ru')}`
|
||||
} />
|
||||
<Points points={user.data?.points} />
|
||||
)
|
||||
}>
|
||||
<SignOut />
|
||||
</BackHeader>
|
||||
|
||||
<Points points={gotError(user) ? -1 : user.data?.points} />
|
||||
{userCategories.map(cat => (
|
||||
<CategoryPreview key={cat} category={cat} />
|
||||
))}
|
||||
|
Reference in New Issue
Block a user