Merge branch 'develop_bitOut' into sentry

This commit is contained in:
Eudes Inácio
2022-12-19 19:37:30 +01:00
8 changed files with 127 additions and 61 deletions
+22 -3
View File
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Attachment, EventAttachment } from '../models/attachment.model';
import { Attachment } from '../models/attachment.model';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@@ -7,6 +7,7 @@ import { LoginUserRespose } from '../models/user.model';
import { SessionStore } from '../store/session.service';
import { File } from '@ionic-native/file/ngx';
import { Platform } from '@ionic/angular';
import { ChangeProfileService } from './change-profile.service';
@Injectable({
providedIn: 'root'
@@ -16,11 +17,29 @@ export class AttachmentsService {
loggeduser: LoginUserRespose;
headers: HttpHeaders;
constructor(private http: HttpClient, private platform: Platform, private file: File) {
constructor(
private http: HttpClient,
private platform: Platform,
private file: File,
private changeProfileService: ChangeProfileService) {
this.changeProfileService.registerCallback(() => {
this.loggeduser = SessionStore.user
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
})
this.changeProfileService.registerLoginCallback(() => {
this.loggeduser = SessionStore.user
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
})
this.loggeduser = SessionStore.user
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
}
uploadFile(formData:any) {
+1
View File
@@ -223,6 +223,7 @@ export class AuthService {
SessionStore.setInativity(false)
SessionStore.setUrlBeforeInactivity(this.router.url);
setTimeout(() => {
// alert('logout')
this.router.navigateByUrl('/', { replaceUrl: true });
}, 100)
@@ -12,6 +12,12 @@ export class ChangeProfileService {
id: string
}[] = []
callbacksLogin: {
funx: Function
id: string
}[] = []
constructor() { }
@@ -23,6 +29,15 @@ export class ChangeProfileService {
return id;
}
registerLoginCallback(funx: Function, object: any = {} ) {
const id = uuidv4()
this.callbacksLogin.push({funx, id})
return id;
}
deleteCallback(id) {
this.callbacks.forEach((e, index)=> {
if(e.id == id) {
@@ -38,5 +53,11 @@ export class ChangeProfileService {
e.funx()
})
}
runLogin() {
this.callbacksLogin.forEach((e, index)=> {
e.funx()
})
}
}