Merge branch 'feature/websocket' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/websocket

This commit is contained in:
tiago.kayaya
2022-01-11 12:34:49 +01:00
15 changed files with 424 additions and 116 deletions
+33 -2
View File
@@ -30,13 +30,25 @@ export class AuthService {
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
//private realtimeChat: RocketChatClientService;
) {
private RocketChatClientService: RocketChatClientService) {
this.headers = new HttpHeaders();
if (SessionStore.exist) {
this.ValidatedUser = SessionStore.user
console.log('login', SessionStore.user.RochetChatUser, SessionStore.user.Password)
this.RocketChatClientService.connect(()=>{
this.RocketChatClientService.login({
username: SessionStore.user.RochetChatUser,
password: SessionStore.user.Password
}).then((message) => {
console.log('rocket chat login successfully', message)
}).catch((message)=>{
console.log('rocket chat login failed', message)
})
})
}
if (localStorage.getItem("userChat") != null) {
@@ -78,6 +90,9 @@ export class AuthService {
session.Profile = 'MDGPR'
}
session.Password = user.password
session.RochetChatUser = user.username.split('@')[0]
session.BasicAuthKey = user.BasicAuthKey
SessionStore.reset(session)
@@ -99,6 +114,22 @@ export class AuthService {
"password": user.password,
}
this.RocketChatClientService.connect(()=>{
this.RocketChatClientService.login({
username: SessionStore.user.RochetChatUser,
password: user.password
}).then((message) => {
console.log('rocket chat login successfully', message)
}).catch((message)=>{
console.log('rocket chat login failed', message)
}).finally(()=>{
})
})
let responseChat = await this.httpService.post('login', postData).toPromise();
if(responseChat) {