@@ -16,6 +16,7 @@ export class InviteComponent implements OnInit {
1616 password : string ;
1717 nameTaken : boolean = false ;
1818 userErrorMsg : string ;
19+ loading : boolean = false ;
1920
2021 constructor (
2122 private roomSrv : RoomService ,
@@ -33,6 +34,7 @@ export class InviteComponent implements OnInit {
3334
3435 enterRoom ( ) {
3536 if ( this . userSrv . isLogged ) { //User is logged
37+ this . loading = true ;
3638 this . userName = this . userSrv . user . name ;
3739 if ( this . userSrv . isModOfRoom ( this . roomName ) ) { //Direct access if already a mod
3840 this . router . navigate ( [ '/' , this . roomName ] ) ;
@@ -43,6 +45,7 @@ export class InviteComponent implements OnInit {
4345 this . router . navigate ( [ '/' , this . roomName ] ) ;
4446 } ,
4547 error => {
48+ this . loading = false ;
4649 console . log ( error )
4750 }
4851 ) ;
@@ -53,6 +56,7 @@ export class InviteComponent implements OnInit {
5356 } else if ( this . password == null ) {
5457 this . userErrorMsg = 'You must enter a password' ;
5558 } else {
59+ this . loading = true ;
5660 this . userSrv . register ( this . userName , this . password ) . subscribe (
5761 ( _ ) => {
5862 this . roomSrv . enterRoom ( this . code ) . subscribe (
@@ -62,11 +66,13 @@ export class InviteComponent implements OnInit {
6266 this . router . navigate ( [ '/' , this . roomName ] ) ;
6367 } ,
6468 error => {
69+ this . loading = false ;
6570 console . log ( error )
6671 }
6772 ) ;
6873 } ,
6974 error => {
75+ this . loading = false ;
7076 this . userErrorMsg = 'Username already taken' ;
7177 }
7278 ) ;
0 commit comments