1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-24 16:01:20 +01:00
Whalebird-desktop-client-ma.../renderer/components/detail/profile/Followers.tsx
2023-12-02 15:06:47 +09:00

31 lines
662 B
TypeScript

import { Entity, MegalodonInterface } from 'megalodon'
import { useEffect, useState } from 'react'
import User from './User'
type Props = {
client: MegalodonInterface
user_id: string
}
export default function Followers(props: Props) {
const [users, setUsers] = useState<Array<Entity.Account>>([])
useEffect(() => {
if (props.user_id) {
const f = async () => {
const res = await props.client.getAccountFollowers(props.user_id)
setUsers(res.data)
}
f()
}
}, [props.client, props.user_id])
return (
<>
{users.map((user, index) => (
<User user={user} key={index} />
))}
</>
)
}