You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
934 B
37 lines
934 B
import React, { FC, useEffect } from 'react'
|
|
import { RouteComponentProps } from 'react-router-dom'
|
|
import { setTitle } from 'src/utils'
|
|
|
|
import { Entity } from 'src/types'
|
|
|
|
import PageHeader from 'src/components/page-header'
|
|
|
|
interface Props extends RouteComponentProps {
|
|
checked: boolean
|
|
authenticated: boolean
|
|
user?: Entity
|
|
}
|
|
|
|
const Self: FC<Props> = ({ checked, authenticated, user, history }) => {
|
|
useEffect(() => {
|
|
if (checked && !authenticated) history.push('/login')
|
|
}, [checked, authenticated])
|
|
|
|
useEffect(() => {
|
|
if (user) setTitle(`${user.name} (@${user.id})`)
|
|
}, [user])
|
|
|
|
return (
|
|
<div>
|
|
<PageHeader title={user ? user.name as string : '?'} subtitle={user ? user.id : '?'} />
|
|
|
|
<div className="main-content">
|
|
<p>
|
|
Hello.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Self
|