This commit is contained in:
Peter Maquiran
2022-12-13 17:21:48 +01:00
parent 2beb3d4387
commit 9116ac4d06
14 changed files with 68 additions and 63 deletions
+2 -10
View File
@@ -34,11 +34,9 @@ export class AuthService {
constructor(
private http: HttpClient,
private httpService: HttpService,
private storageService:StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
private RochetChatConnectorService: RochetChatConnectorService,
private router: Router,
private NfService:NfService,
@@ -96,6 +94,8 @@ export class AuthService {
session.Profile = 'MDGPR'
} else if(session.RoleID == 99999872) {
session.Profile = 'Consultant'
} else {
session.Profile = 'Unknown'
}
session.Password = user.password
@@ -111,14 +111,6 @@ export class AuthService {
this.initialsService.getInitials(session.FullName);
}
async loginChat(responseChat?) {
}
async autoLoginChat(expirationDate:number) {
}
loginToChatWs() {
setTimeout(() => {
+30 -12
View File
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { ThemeService } from 'src/app/services/theme.service';
import { StorageService} from 'src/app/services/storage.service';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
@@ -15,7 +17,8 @@ export class BackgroundService {
constructor(
private themeservice: ThemeService,
private storageservice: StorageService
private storageservice: StorageService,
private http: HttpClient,
) { }
online() {
@@ -54,18 +57,33 @@ export class BackgroundService {
}
}
offline() {
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
async offline() {
let opts = {
headers: {},
}
try {
await this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts).toPromise();
} catch (error) {
if(error.status != 400) {
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
}
})
}
})
}
}
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
+2 -2
View File
@@ -343,7 +343,7 @@ export class ChatService {
setheader() {
try {
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) {
this.headers = new HttpHeaders();
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
@@ -364,7 +364,7 @@ export class ChatService {
async refreshtoken() {
if(this.headers) {
if(this.headers && SessionStore.user.ChatData) {
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
let options = {
headers: this.headers
@@ -576,6 +576,8 @@ export class ChatSystemService {
const firstName = capitalizeTxt(roomName.split('.')[0])
const lastName = capitalizeTxt(roomName.split('.')[1])
return firstName + ' ' + lastName
} else if(roomData.name) {
return roomData.name
} else {
return 'Sem nome'
}