Fix JS linting issues

This commit is contained in:
Essem 2024-01-28 13:52:08 -06:00
parent 7940b067b9
commit acae7d57e4
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
2 changed files with 16 additions and 28 deletions

View file

@ -59,25 +59,19 @@ export const accountsReducer: Reducer<typeof initialState> = (
return normalizeAccounts(state, action.payload.accounts);
else if (followAccountSuccess.match(action)) {
return state
.update(
action.payload.relationship.id,
(account) => account?.update('followers_count', (n) => n + 1),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => n + 1),
)
.update(
getCurrentUser(),
(account) => account?.update('following_count', (n) => n + 1),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => n + 1),
);
} else if (unfollowAccountSuccess.match(action))
return state
.update(
action.payload.relationship.id,
(account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
)
.update(
getCurrentUser(),
(account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
);
else return state;
};

View file

@ -59,25 +59,19 @@ export const accountsReducer: Reducer<typeof initialState> = (
return normalizeAccounts(state, action.payload.accounts);
else if (followAccountSuccess.match(action)) {
return state
.update(
action.payload.relationship.id,
(account) => account?.update('followers_count', (n) => n + 1),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => n + 1),
)
.update(
getCurrentUser(),
(account) => account?.update('following_count', (n) => n + 1),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => n + 1),
);
} else if (unfollowAccountSuccess.match(action))
return state
.update(
action.payload.relationship.id,
(account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
)
.update(
getCurrentUser(),
(account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
);
else return state;
};