-state
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 6m24s

This commit is contained in:
x2Skyz
2025-11-23 18:43:10 +07:00
parent 43ed6c0c55
commit 0d43286d84
3 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { IProjectSearchResponse, ITransactionSearchResponse } from '../../interfaces/dashboard.interface';
@Injectable({
providedIn: 'root'
})
export class ProjectStateService {
private projectState = new BehaviorSubject<IProjectSearchResponse | null>(null);
private transactionState = new BehaviorSubject<ITransactionSearchResponse | null>(null);
getProjectState(): Observable<IProjectSearchResponse | null> {
return this.projectState.asObservable();
}
setProjectState(project: IProjectSearchResponse): void {
this.projectState.next(project);
}
getTransactionState(): Observable<ITransactionSearchResponse | null> {
return this.transactionState.asObservable();
}
setTransactionState(transaction: ITransactionSearchResponse): void {
this.transactionState.next(transaction);
}
clearState(): void {
this.projectState.next(null);
this.transactionState.next(null);
}
}