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

import { DashboardDataService } from '../../_services/apollo.service'

@Injectable()
export class DashboardPageResolver  {
    constructor(
        private dashboardDataService: DashboardDataService,
    ) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<object> {
        return this.dashboardDataService.getDashboardPage(
            route.paramMap.get('group'),
            route.paramMap.get('name')
        )
    }
}
