Removed ability to delete last Profile

This commit is contained in:
2023-04-05 12:50:18 +02:00
parent f24ea21d8c
commit fd1d8e2b51

View File

@@ -236,6 +236,10 @@ function ProfileSettings({setNameProfile, setProfileName, setNewProfileName, pro
</svg> </svg>
</button> </button>
<button title="Delete" style={{width:"35px", height:"35px", backgroundColor:"#e1334e", marginLeft:"5px"}} onClick={() => { <button title="Delete" style={{width:"35px", height:"35px", backgroundColor:"#e1334e", marginLeft:"5px"}} onClick={() => {
if (getProfiles().length === 1) {
logger.warningMSG("You can't delete the last profile!");
return;
}
removeProfile(profileName); removeProfile(profileName);
const newActiveProfile = getProfiles()[getProfiles().length - 1]; const newActiveProfile = getProfiles()[getProfiles().length - 1];
setActiveProfile(newActiveProfile); setActiveProfile(newActiveProfile);