Ajax ו promises

שלום שלום ,עברתי על קורס הפרונט אנד בנושאים של ajax ו promises

כתבתי חלק מצד השרת כפי שכתוב בקורס .

ואני מקבל הודעת שגיאה

uncaught syntaxerror illegal return statement

אשמח לעזרה

const serverurl =‘http://localhost:8080’;

class messageService
{
constructor()
{
this.token =null;
}
login(username)
{
const xhr=new XMLHttpRequest();
xhr.open(‘post’,${serverurl}/login) ;
xhr.setRequestHeadr(‘Content-Type’,‘application/json’);
xhr.send(JSON.stringify({username:username}));
xhr.addEventListener(‘load’,this.loginComplete.bind(this));
xhr.addEventListener(‘error’,this.error.bind(this));
const data =JSON.parse(xhr.responseText);
this.token = data.token;
console.log(got token : ${this.token});
}
}

loginComplete(evt)
{
const xhr = evt.Target;

if (xhr.status !== 200) { return this.error(evt) }; <------
const data = JSON.parse(xhr.responseText);
this.token=data.token;
console.log(got token : ${this.token})
}
sendMessage(text,to = null);
{}
sendMessageComplete(evt);
{}
logMessage();{}

loginComplete(evt);{}

console.error(evt);
{}