useFollow: don't go below 0

This commit is contained in:
Alex Gleason
2023-06-22 23:47:46 -05:00
parent 75dbeb65b6
commit 7bfde28b0c

View File

@ -30,7 +30,7 @@ function useFollow() {
function decrementFollowers(accountId: string) {
changeAccount(accountId, (account) => ({
...account,
followers_count: account.followers_count - 1,
followers_count: Math.max(0, account.followers_count - 1),
}));
}