diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index d147768af..17b45ac9f 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -29,7 +29,7 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/']); return false } else { - //this.authService.loginChat(); + this.authService.loginChat(); return true; } } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index c96c68dd3..37a27b44f 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -102,8 +102,8 @@ export class LoginPage implements OnInit { if (attempt) { if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - // await this.authService.loginChat(); - // await this.authService.loginToChatWs() + await this.authService.loginChat(); + await this.authService.loginToChatWs() this.getToken(); SessionStore.setInativity(true); @@ -117,8 +117,8 @@ export class LoginPage implements OnInit { await this.authService.SetSession(attempt, this.userattempt); this.changeProfileService.run() - // await this.authService.loginChat(); - // await this.authService.loginToChatWs() + await this.authService.loginChat(); + await this.authService.loginToChatWs() this.getToken(); this.router.navigateByUrl('/pin', { replaceUrl: true }); } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index b41ccd40c..7ab471218 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -56,9 +56,9 @@ export class AuthService { } - /* if (localStorage.getItem("userChat") != null) { + if (localStorage.getItem("userChat") != null) { this.ValidatedUserChat = JSON.parse(localStorage.getItem('userChat')); - } */ + } } @@ -112,7 +112,7 @@ export class AuthService { //user: UserForm async loginChat() { - /* const expirationMinutes = 30; + const expirationMinutes = 30; let date = new Date().getTime(); let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000); @@ -135,7 +135,7 @@ export class AuthService { this.presentAlert('Network error'); } - this.autoLoginChat(expirationDate.getTime() - date); */ + this.autoLoginChat(expirationDate.getTime() - date); } async autoLoginChat(expirationDate:number){ @@ -145,7 +145,7 @@ export class AuthService { } loginToChatWs() { - /* setTimeout(()=>{ + setTimeout(()=>{ this.WsChatService.connect(); this.WsChatService.login().then((message) => { @@ -225,7 +225,7 @@ export class AuthService { return false } }; - }, 1) */ + }, 1) } autologout(expirationDate:number) { diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index e5da6103b..d4b8512f0 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -32,13 +32,13 @@ export class ChatService { private storageService:StorageService, ) { - /* this.loggedUserChat = authService.ValidatedUserChat; + this.loggedUserChat = authService.ValidatedUserChat; this.headers = new HttpHeaders(); this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); this.options = { headers: this.headers, - }; */ + }; } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 6ed05505b..2c9100ef6 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,8 +6,8 @@ export const environment = { production: false, apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', - apiChatUrl: 'https://gpr-dev-01.gabinetedigital.local/api/v1/', - apiWsChatUrl: 'ws://gpr-dev-01.gabinetedigital.local/websocket', + apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', + apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', //apiChatUrl: 'https://www.tabularium.pt/api/v1/', /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ domain: 'gabinetedigital.local', //gabinetedigital.local