tooot/src/screens/Me/Root/MyInfo.tsx

31 lines
839 B
TypeScript
Raw Normal View History

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'
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 (
<>
<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