This commit is contained in:
Eudes Inácio
2021-10-18 07:44:49 +01:00
9 changed files with 105 additions and 132 deletions
+7 -2
View File
@@ -9,6 +9,7 @@ import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
@Injectable({
providedIn: 'root'
@@ -27,6 +28,7 @@ export class AuthService {
private storageService:StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
) {
this.headers = new HttpHeaders();
@@ -102,8 +104,11 @@ export class AuthService {
console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].authToken));
localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].userId));
localStorage.setItem('Meteor.loginToken', responseChat['data'].authToken);
localStorage.setItem('Meteor.userId',responseChat['data'].userId);
this.cookieService.set('rc_token', responseChat['data'].authToken);
this.cookieService.set('rc_uid', responseChat['data'].userId);
alert(this.cookieService.get('rc_uid'));
this.storageService.store(AuthConnstants.AUTH, responseChat);
return true;
}