@@ -4,7 +4,7 @@ import { FormGroup } from '@angular/forms';
4
4
import { DockerHubService } from '../../docker-hub/docker-hub.service' ;
5
5
import { NotificationService } from '../../shared/notification.service' ;
6
6
import { RegistryService } from '../../registry/registry.service' ;
7
- import { Observable , throwError } from 'rxjs' ;
7
+ import { Observable , throwError , of } from 'rxjs' ;
8
8
import { take , catchError } from 'rxjs/operators' ;
9
9
import { HttpErrorResponse } from '@angular/common/http' ;
10
10
import { DockerRegistrySettings } from '../settings.model' ;
@@ -39,14 +39,17 @@ export class RegistrySettingsModalComponent implements OnInit {
39
39
if ( registrySettings . isDockerHub ) {
40
40
const username = registrySettings . username ;
41
41
const password = registrySettings . password ;
42
- obs = this . dockerHub . logIn ( username , password )
43
- . pipe ( catchError ( ( error : HttpErrorResponse ) => {
44
- this . notification . open ( error . error . detail || error . message , null , {
45
- panelClass : 'tim-bg-warn'
46
- } ) ;
47
- return throwError ( error ) ;
48
- } ) ) ;
49
-
42
+ if ( username ) {
43
+ obs = this . dockerHub . logIn ( username , password )
44
+ . pipe ( catchError ( ( error : HttpErrorResponse ) => {
45
+ this . notification . open ( error . error . detail || error . message , null , {
46
+ panelClass : 'tim-bg-warn'
47
+ } ) ;
48
+ return throwError ( error ) ;
49
+ } ) ) ;
50
+ } else {
51
+ obs = of ( null ) ;
52
+ }
50
53
} else {
51
54
obs = this . registry . testRegistrySettings ( registrySettings )
52
55
. pipe ( catchError ( ( error : HttpErrorResponse ) => {
0 commit comments