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

import { AdminManageDataService } from '../data.service'
import { Project } from '../../../openapi'


@Injectable()
export class ProjectResolver  {
    constructor(
        private adminManageDataService: AdminManageDataService,
        private router: Router
    ) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Project[]> {
        return this.adminManageDataService.getProjects()
    }
}
