added token
This commit is contained in:
parent
1950112202
commit
baf11f19d6
1 changed files with 2 additions and 1 deletions
|
@ -13,9 +13,10 @@ function ChangeUsername(): JSX.Element {
|
||||||
const handleSubmit = async (): Promise<void> => {
|
const handleSubmit = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
// Call the API function to change the username
|
// Call the API function to change the username
|
||||||
|
const token = localStorage.getItem("accessToken") ?? "";
|
||||||
const response = await api.changeUserName(
|
const response = await api.changeUserName(
|
||||||
{ prevName: "currentName", newName: newUsername },
|
{ prevName: "currentName", newName: newUsername },
|
||||||
"token",
|
token,
|
||||||
);
|
);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
// Optionally, add a success message or redirect the user
|
// Optionally, add a success message or redirect the user
|
||||||
|
|
Loading…
Reference in a new issue