2020-12-13 14:04:25 +01:00
|
|
|
import AccountHeader from '@screens/Shared/Account/Header'
|
|
|
|
import AccountInformation from '@screens/Shared/Account/Information'
|
2021-01-11 21:36:57 +01:00
|
|
|
import { useAccountQuery } from '@utils/queryHooks/account'
|
2021-01-07 19:13:09 +01:00
|
|
|
import { getLocalAccount } from '@utils/slices/instancesSlice'
|
2021-01-03 02:00:26 +01:00
|
|
|
import React, { useEffect } from 'react'
|
|
|
|
import { useSelector } from 'react-redux'
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2020-12-18 00:00:45 +01:00
|
|
|
export interface Props {
|
|
|
|
setData: React.Dispatch<React.SetStateAction<Mastodon.Account | undefined>>
|
|
|
|
}
|
|
|
|
|
|
|
|
const MyInfo: React.FC<Props> = ({ setData }) => {
|
2021-01-07 19:13:09 +01:00
|
|
|
const localAccount = useSelector(getLocalAccount)
|
2021-01-11 21:36:57 +01:00
|
|
|
const { data } = useAccountQuery({ id: localAccount!.id })
|
2021-01-07 19:13:09 +01:00
|
|
|
|
2020-12-18 00:00:45 +01:00
|
|
|
useEffect(() => {
|
|
|
|
if (data) {
|
|
|
|
setData(data)
|
|
|
|
}
|
|
|
|
}, [data])
|
2020-11-22 00:46:23 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2021-01-03 02:00:26 +01:00
|
|
|
<AccountHeader account={data} limitHeight />
|
2021-01-24 02:25:43 +01:00
|
|
|
<AccountInformation account={data} myInfo />
|
2020-11-22 00:46:23 +01:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MyInfo
|