Skip to content

Commit

Permalink
Move the hardcoding into a third-party query #3342
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrutherford committed Jun 20, 2024
1 parent 74175a4 commit a830edd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import * as RA from 'fp-ts/ReadonlyArray';
import * as TE from 'fp-ts/TaskEither';
import { pipe } from 'fp-ts/function';
import { fetchSearchCategories } from '../../../../third-parties/fetch-search-categories';
import * as DE from '../../../../types/data-error';
import { ViewModel } from '../view-model';

const titles = [
'Infectious Diseases (except HIV/AIDS)',
'Epidemiology',
];

export const constructViewModel = (): TE.TaskEither<DE.DataError, ViewModel> => pipe(
TE.right(titles),
fetchSearchCategories(),
TE.map(RA.map((title) => ({
title,
href: `https://labs.sciety.org/categories/articles?category=${title}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as TE from 'fp-ts/TaskEither';
import * as DE from '../../types/data-error';

type Titles = ReadonlyArray<string>;

const titles = [
'Infectious Diseases (except HIV/AIDS)',
'Epidemiology',
];

export const fetchSearchCategories = (): TE.TaskEither<DE.DataError, Titles> => TE.right(titles);
1 change: 1 addition & 0 deletions src/third-parties/fetch-search-categories/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { fetchSearchCategories } from './fetch-search-categories';

0 comments on commit a830edd

Please sign in to comment.