diff --git a/src/app/_services/auth.service.ts b/src/app/_services/auth.service.ts index 9018a73..731602a 100644 --- a/src/app/_services/auth.service.ts +++ b/src/app/_services/auth.service.ts @@ -25,7 +25,7 @@ export class AuthService { this.mutableKeyStore = new MutablePgpKeyStore() } - async init(): void { + async init(): Promise { this.mutableKeyStore.loadKeyring(); // TODO setting these together shoulds be atomic if (sessionStorage.getItem(btoa('CICADA_SESSION_TOKEN'))) { @@ -97,36 +97,6 @@ export class AuthService { xhr.send(); } - - login(): boolean { - // TODO check if we have privatekey - // Send us to home if we have a private key - // talk to meta somehow - // in the error interceptor if 401/403 handle it - // if 200 go /home - if (!this.getPrivateKey()) { - return false; - } - return true; - // if (this.sessionToken !== undefined) { - // try { - // //this.getWithToken(); - // return true; - // } catch (e) { - // this.loggingService.sendErrorLevelMessage('Login token failed', this, {error: e}); - // } - // } else { - // try { - // // this.getChallenge(); - // return true - // } catch (e) { - // this.loggingService.sendErrorLevelMessage('Login challenge failed', this, {error: e}); - // } - // } - //return false; - } - - async loginResponse(o): Promise { return new Promise(async(resolve, reject) => { try { diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts index ed544fc..c27df3a 100644 --- a/src/app/auth/auth.component.ts +++ b/src/app/auth/auth.component.ts @@ -46,8 +46,12 @@ export class AuthComponent implements OnInit { } login(): void { - const loginStatus = this.authService.login(); - if (loginStatus) { + // TODO check if we have privatekey + // Send us to home if we have a private key + // talk to meta somehow + // in the error interceptor if 401/403 handle it + // if 200 go /home + if (this.authService.getPrivateKey()) { this.router.navigate(['/home']); } }