import { actionChangeSubscribeSaga } from '../actions/typeSaga/subscribeTypesSaga'
import { Button } from 'antd'
import { connect } from 'react-redux'
const Subscribe = ({ aboutMeFollowing = [], changeSubscribe, followId }) => {
const checkFollowId = aboutMeFollowing?.find(
(follower) => follower?._id === followId,
)?._id
return (
<>
changeSubscribe(followId, checkFollowId)}
>
{checkFollowId ? (
) : (
)}
>
)
}
export const CSubscribe = connect(
(state) => ({
myId: state.auth?.payload?.sub?.id,
aboutMeFollowing: state.myData?.aboutMe?.following,
followId: state.userData?.aboutUser?._id,
}),
{
changeSubscribe: actionChangeSubscribeSaga,
},
)(Subscribe)
export const CSubscribeLinkUser = connect(
(state) => ({
myId: state.auth?.payload?.sub?.id,
aboutMeFollowing: state.myData?.aboutMe?.following,
}),
{
changeSubscribe: actionChangeSubscribeSaga,
},
)(Subscribe)