Reducers: TypeScript

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2022-06-04 09:22:36 +02:00
parent 666c2dd0ce
commit 65dff4e6a1
50 changed files with 473 additions and 370 deletions

View File

@@ -29,14 +29,14 @@ const mapStateToProps = state => {
const mapDispatchToProps = (dispatch) => ({
onSubscriptionToggle(account) {
if (account.getIn(['relationship', 'subscribing'])) {
if (account.relationship?.subscribing) {
dispatch(unsubscribeAccount(account.get('id')));
} else {
dispatch(subscribeAccount(account.get('id')));
}
},
onNotifyToggle(account) {
if (account.getIn(['relationship', 'notifying'])) {
if (account.relationship?.notifying) {
dispatch(followAccount(account.get('id'), { notify: false }));
} else {
dispatch(followAccount(account.get('id'), { notify: true }));
@@ -60,9 +60,9 @@ class SubscriptionButton extends ImmutablePureComponent {
render() {
const { account, intl, features } = this.props;
const subscribing = features.accountNotifies ? account.getIn(['relationship', 'notifying']) : account.getIn(['relationship', 'subscribing']);
const following = account.getIn(['relationship', 'following']);
const requested = account.getIn(['relationship', 'requested']);
const subscribing = features.accountNotifies ? account.relationship?.notifying : account.relationship?.subscribing;
const following = account.relationship?.following;
const requested = account.relationship?.requested;
if (requested || following) {
return (