Add user logout.
This commit is contained in:
@@ -47,7 +47,7 @@ export class AuthService {
|
||||
throw new Error('login rejected');
|
||||
}
|
||||
this.sessionLoginCount++;
|
||||
this.setState('Click button to perform login ' + this.sessionLoginCount + ' with token ' + this.sessionToken);
|
||||
this.setState('Click button to log in');
|
||||
return;
|
||||
});
|
||||
xhr.send();
|
||||
@@ -67,7 +67,7 @@ export class AuthService {
|
||||
this.sessionToken = xhr.getResponseHeader('Token');
|
||||
sessionStorage.setItem(btoa('CICADA_SESSION_TOKEN'), this.sessionToken);
|
||||
this.sessionLoginCount++;
|
||||
this.setState('Click button to perform login ' + this.sessionLoginCount + ' with token ' + this.sessionToken);
|
||||
this.setState('Click button to log in');
|
||||
return;
|
||||
});
|
||||
xhr.send();
|
||||
@@ -147,6 +147,7 @@ export class AuthService {
|
||||
|
||||
logout(): void {
|
||||
sessionStorage.removeItem(btoa('CICADA_SESSION_TOKEN'));
|
||||
this.sessionToken = undefined;
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user