New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bootzooka frontend - the more functional way #540
base: master
Are you sure you want to change the base?
Conversation
It's still [WIP] |
import reporter from 'io-ts-reporters'; | ||
import axios, { AxiosRequestConfig } from "axios"; | ||
|
||
export async function fetchJson<T, O, I>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to split this method into two responsibilities. One responsible for getting the data and the second one for validating it
url: string, | ||
validator: Type<T, O, I>, | ||
config: AxiosSecuredRequestConfig = { securedRequest: true }, | ||
): Promise<E.Either<Error, T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should use TaskEither ?
No description provided.