new session service

This commit is contained in:
Peter Maquiran
2023-07-10 12:32:01 +01:00
parent 9676bab7eb
commit f6f61a11ca
13 changed files with 116 additions and 71 deletions
+3 -7
View File
@@ -19,7 +19,7 @@ import { InitialsService } from './functions/initials.service';
import { PermissionService } from './permission.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { DocumentManagementStore } from '../store/documentManagement';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -32,8 +32,6 @@ export class AuthService {
opts:any;
tabIsActive = true
DocumentManagementStore = DocumentManagementStore
constructor(
private http: HttpClient,
@@ -78,9 +76,6 @@ export class AuthService {
async login(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
// Basic peter.maquiran@equilibrium.co.ao:senha123456
// console.log(user.BasicAuthKey)
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
@@ -119,7 +114,8 @@ export class AuthService {
if(saveSession) {
/* this.SetSession(response, user) */
this.DocumentManagementStore.setData(response)
console.log('teste', response);
CPSession.save(response)
}
} catch (error) {