Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
ntqdinh-axonivy committed Dec 17, 2024
1 parent c523f9e commit d5985a9
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Injectable, signal } from '@angular/core';
})
export class LoadingService {
loadingStates = signal<{ [key: string]: boolean }>({});
activeCallCount = signal<number>(0);

private setLoading(componentId: string, isLoading: boolean): void {
this.loadingStates.update(states => {
Expand All @@ -16,14 +15,10 @@ export class LoadingService {
}

showLoading(componentId: string): void {
this.activeCallCount.set(this.activeCallCount() + 1);
this.setLoading(componentId, true);
}

hideLoading(componentId: string) {
if (this.activeCallCount() > 0) {
this.activeCallCount.set(this.activeCallCount() - 1);
}
this.setLoading(componentId, false);
}
}

0 comments on commit d5985a9

Please sign in to comment.