Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
fix: log out from docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Chaia committed Oct 30, 2018
1 parent 0408e3d commit 092b7c7
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormGroup } from '@angular/forms';
import { DockerHubService } from '../../docker-hub/docker-hub.service';
import { NotificationService } from '../../shared/notification.service';
import { RegistryService } from '../../registry/registry.service';
import { Observable, throwError } from 'rxjs';
import { Observable, throwError, of } from 'rxjs';
import { take, catchError } from 'rxjs/operators';
import { HttpErrorResponse } from '@angular/common/http';
import { DockerRegistrySettings } from '../settings.model';
Expand Down Expand Up @@ -39,14 +39,17 @@ export class RegistrySettingsModalComponent implements OnInit {
if (registrySettings.isDockerHub) {
const username = registrySettings.username;
const password = registrySettings.password;
obs = this.dockerHub.logIn(username, password)
.pipe(catchError((error: HttpErrorResponse) => {
this.notification.open(error.error.detail || error.message, null, {
panelClass: 'tim-bg-warn'
});
return throwError(error);
}));

if (username) {
obs = this.dockerHub.logIn(username, password)
.pipe(catchError((error: HttpErrorResponse) => {
this.notification.open(error.error.detail || error.message, null, {
panelClass: 'tim-bg-warn'
});
return throwError(error);
}));
} else {
obs = of(null);
}
} else {
obs = this.registry.testRegistrySettings(registrySettings)
.pipe(catchError((error: HttpErrorResponse) => {
Expand Down

0 comments on commit 092b7c7

Please sign in to comment.