Added sign out button to user page

This commit is contained in:
2023-07-27 20:07:25 +03:00
parent d93b2e131c
commit 50c2b0a615
7 changed files with 52 additions and 12 deletions

View File

@ -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} />
))}