import { inject } from '@angular/core';
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
import { take } from 'rxjs/operators';

import { JumpPageData } from '@models';
import { JumpsService } from '@services';

export const jumpResolver: ResolveFn<JumpPageData> = (
    route: ActivatedRouteSnapshot
) => {
    return inject(JumpsService).get(route.params['slug']).pipe(take(1));
};