import { Injectable } from '@angular/core'
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router'
import { Observable, forkJoin } from 'rxjs'
import { map } from 'rxjs/operators'

import { AdminBasket, AdminBasketDataService } from './data.service'

@Injectable()
export class BasketResolver  {
    constructor(
        private router: Router,
        private basketDataService: AdminBasketDataService,
    ) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<AdminBasket> {
        var name = route.paramMap.get('name')
        return this.basketDataService.getBasket(name)
    }
}
