-state
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 6m24s
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 6m24s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user