Updated user to use latest api

This commit is contained in:
2023-08-08 18:32:14 +03:00
parent 60779ea489
commit f432193508
5 changed files with 35 additions and 50 deletions

View File

@ -5,17 +5,19 @@ import { userCategories } from '../assets/userCategories'
import { BackHeader, CategoryPreview, Poetry, Points, SignOut } from '../components'
import { gotError, gotResponse } from '../hooks/useFetch'
import styles from '../styles/UserPage.module.css'
function UserPage() {
const user = useUser()
return (
<Container style={{ maxWidth: 'calc(100vh*9/16)' }}>
<Container className={styles.sixteenXnine}>
<BackHeader text={
gotResponse(user) ? (
gotError(user) ? (
user.error
) : (
`${user.data.name}, с нами с ${new Date(user.data.regDate).toLocaleDateString('ru')}`
`${user.data.nickname}, с нами с ${user.data.regDate}`
)
) : (
'Загрузка...'