mirror of
https://github.com/plebbit/seedit.git
synced 2026-05-19 06:04:56 -04:00
fix(account settings): prevent deleting last account, reload page when changing active account
This commit is contained in:
@@ -31,6 +31,7 @@ const AccountSettings = () => {
|
||||
const lastAccount = accounts[accounts.length - 1];
|
||||
setActiveAccount(lastAccount.name);
|
||||
setSwitchToLastAccount(false);
|
||||
window.location.reload();
|
||||
}
|
||||
}, [accounts, switchToLastAccount]);
|
||||
|
||||
@@ -49,7 +50,10 @@ const AccountSettings = () => {
|
||||
};
|
||||
|
||||
const _deleteAccount = (accountName: string) => {
|
||||
if (!accountName) {
|
||||
if (accounts.length === 1) {
|
||||
alert('You cannot delete your last account. Please create a new one.');
|
||||
return;
|
||||
} else if (!accountName) {
|
||||
return;
|
||||
} else if (window.confirm(`Are you sure you want to delete ${accountName}?`)) {
|
||||
deleteAccount(accountName);
|
||||
|
||||
Reference in New Issue
Block a user