Lint changes from master.

This commit is contained in:
Spencer Ofwiti 2021-06-10 17:29:23 +03:00
parent 157f88b052
commit c0c94d3e2d
2 changed files with 63 additions and 67 deletions

View File

@ -59,9 +59,9 @@ export class AuthService {
};
return fetch(environment.cicMetaUrl, options).then((response) => {
if (!response.ok) {
this.loggingService.sendErrorLevelMessage('failed to get with auth token.',
this,
{ error: "" });
this.loggingService.sendErrorLevelMessage('failed to get with auth token.', this, {
error: '',
});
return false;
}
@ -79,12 +79,11 @@ export class AuthService {
const options = {
headers,
};
return fetch(environment.cicMetaUrl, options)
return fetch(environment.cicMetaUrl, options);
}
getChallenge(): Promise<any> {
return fetch(environment.cicMetaUrl)
.then(response => {
return fetch(environment.cicMetaUrl).then((response) => {
if (response.status === 401) {
const authHeader: string = response.headers.get('WWW-Authenticate');
return hobaParseChallengeHeader(authHeader);
@ -105,28 +104,25 @@ export class AuthService {
this.mutableKeyStore
);
const tokenResponse = await this.sendSignedChallenge(r)
.then(response => {
const token = response.headers.get('Token')
const tokenResponse = await this.sendSignedChallenge(r).then((response) => {
const token = response.headers.get('Token');
if (token) {
return token
return token;
}
if (response.status === 401) {
let e = new HttpError("You are not authorized to use this system", response.status)
throw e
throw new HttpError('You are not authorized to use this system', response.status);
}
if (!response.ok) {
let e = new HttpError("Unknown error from authentication server", response.status)
throw e
throw new HttpError('Unknown error from authentication server', response.status);
}
})
});
if (tokenResponse) {
this.setSessionToken(tokenResponse);
this.setState('Click button to log in');
return true
return true;
}
return false
return false;
}
}

View File

@ -22,7 +22,7 @@ export class AuthComponent implements OnInit {
private authService: AuthService,
private formBuilder: FormBuilder,
private router: Router,
private errorDialogService: ErrorDialogService,
private errorDialogService: ErrorDialogService
) {}
async ngOnInit(): Promise<void> {
@ -49,7 +49,7 @@ export class AuthComponent implements OnInit {
async login(): Promise<void> {
try {
const loginResult = await this.authService.login()
const loginResult = await this.authService.login();
if (loginResult) {
this.router.navigate(['/home']);
}