Prevents admin from changing its name

This commit is contained in:
Peter KW 2024-04-11 00:34:56 +02:00
parent c8553d4eae
commit 0d4d77633d

View file

@ -9,6 +9,10 @@ function ChangeUsername(props: { nameChange: StrNameChange }): void {
alert("You have to give a new name\n\nName not changed"); alert("You have to give a new name\n\nName not changed");
return; return;
} }
if (props.nameChange.prevName === localStorage.getItem("username")) {
alert("You cannot change admin name");
return;
}
api api
.changeUserName(props.nameChange, localStorage.getItem("accessToken") ?? "") .changeUserName(props.nameChange, localStorage.getItem("accessToken") ?? "")
.then((response: APIResponse<void>) => { .then((response: APIResponse<void>) => {