Prompt to double-confirm unfollow

pull/1/head
Lim Chee Aun 2022-12-12 10:03:41 +08:00
rodzic 299b638ac3
commit e5fa7536e0
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -155,11 +155,16 @@ export default ({ account }) => {
try { try {
let newRelationship; let newRelationship;
if (following) { if (following) {
const yes = confirm(
'Are you sure that you want to unfollow this account?',
);
if (yes) {
newRelationship = await masto.accounts.unfollow(id); newRelationship = await masto.accounts.unfollow(id);
}
} else { } else {
newRelationship = await masto.accounts.follow(id); newRelationship = await masto.accounts.follow(id);
} }
setRelationship(newRelationship); if (newRelationship) setRelationship(newRelationship);
setRelationshipUIState('default'); setRelationshipUIState('default');
} catch (e) { } catch (e) {
alert(e); alert(e);