brewman/overlord/src/app/net-transactions/net-transactions-resolver.service.ts

21 lines
766 B
TypeScript
Raw Normal View History

import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
import {Observable} from 'rxjs/internal/Observable';
import {NetTransactions} from './net-transactions';
import {NetTransactionsService} from './net-transactions.service';
@Injectable({
providedIn: 'root'
})
export class NetTransactionsResolver implements Resolve<NetTransactions> {
constructor(private ser: NetTransactionsService) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<NetTransactions> {
const startDate = route.queryParamMap.get('startDate') || null;
const finishDate = route.queryParamMap.get('finishDate') || null;
return this.ser.list(startDate, finishDate);
}
}