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

import { Article } from '@models';
import { ArticlesService } from '@services';

export const articlesResolver: ResolveFn<Array<Article>> = () => {
    return inject(ArticlesService).getAll().pipe(take(1));
};