Skip to content
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

change gql mutation uploads to use fetch #146

Merged
merged 8 commits into from
Jan 13, 2024
Merged

change gql mutation uploads to use fetch #146

merged 8 commits into from
Jan 13, 2024

Conversation

ciaranschutte
Copy link
Contributor

@ciaranschutte ciaranschutte commented Jan 12, 2024

  • new functionality
  • change gql mutation uploads to use fetch
  • puts reusable stuff in places where it can be reused

@ciaranschutte ciaranschutte changed the title Add fetch change gql mutation uploads to use fetch Jan 12, 2024
@ciaranschutte ciaranschutte marked this pull request as ready for review January 12, 2024 21:04
const uploadFile = useMutation(
(formData) => {
const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_REGISTRATION, shortName));
return uploadFileRequest(url, formData, egoJwt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function just returns the promise from the fetch to upload the form... is this awaited properly by the useMutation hook? There is also no try/catch or other error handling so I assume you tested this and the useMutation passes a failed request onto the onError function below. It is concerning that we aren't communicating any errors other than "unknown".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the error handling is in the onError options property below.
I agree it's concerning. This is the only error case handled currently in platform-ui

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a different way of doing it. this is how react-query is does it. "hooks" way

@ciaranschutte ciaranschutte merged commit 0e0892f into develop Jan 13, 2024
@ciaranschutte ciaranschutte deleted the add_fetch branch January 13, 2024 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants