fix loader

This commit is contained in:
Peter Maquiran
2024-05-31 12:49:49 +01:00
parent 4fad0e306f
commit c982708972
12 changed files with 170 additions and 137 deletions
+20 -21
View File
@@ -19,7 +19,8 @@ import { Router } from '@angular/router';
import { v4 as uuidv4 } from 'uuid'
import { ChangeProfileService } from './change-profile.service';
import { PermissionService } from './permission.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SortService } from './functions/sort.service';
@Injectable({
providedIn: 'root'
})
@@ -67,6 +68,8 @@ export class TaskService {
private router: Router,
private changeProfileService: ChangeProfileService,
public p: PermissionService,
public AgendaDataRepositoryService: AgendaDataRepositoryService,
private sortService: SortService,
) {
this.changeProfileService.registerCallback(() => {
@@ -315,30 +318,26 @@ export class TaskService {
/* if(this.SessionStore.user.Profile != 'PR') { */
try {
for(let calendar of this.eventService.calendarNamesAry) {
if(calendar == 'Meu calendario') {
// color
let genericEvents = await this.processesbackend.eventsToApprove(SessionStore.user.UserId, false).toPromise();
let eventsList
try {
eventsList = genericEvents
} catch (error) {
eventsList = [];
}
console.log(calendar, eventsList)
this.eventoaprovacaostore.save(calendar, eventsList)
let userId;
if(calendar == 'Meu calendario') {
userId = SessionStore.user.UserId
} else {
let allEvents = await this.processesbackend.eventsToApprove(calendar.OwnerUserId, 'againete page').toPromise()
let eventsList
try {
eventsList = allEvents
} catch(error) {
eventsList = []
}
userId = calendar.OwnerUserId
}
console.log(calendar, eventsList)
this.eventoaprovacaostore.save(calendar.OwnerUserId, eventsList)
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
if(allEvents.isOk()) {
let eventsList = []
if(allEvents.value.length >= 1) {
eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
this.eventoaprovacaostore.save(userId, eventsList)
} else {
this.eventoaprovacaostore.save(userId, [])
}
}
}
} catch (error) {