added token

This commit is contained in:
pavel Hamawand 2024-03-21 02:47:51 +01:00
parent 1950112202
commit baf11f19d6

View file

@ -13,9 +13,10 @@ function ChangeUsername(): JSX.Element {
const handleSubmit = async (): Promise<void> => {
try {
// Call the API function to change the username
const token = localStorage.getItem("accessToken") ?? "";
const response = await api.changeUserName(
{ prevName: "currentName", newName: newUsername },
"token",
token,
);
if (response.success) {
// Optionally, add a success message or redirect the user