-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
ciaranschutte
commented
Jan 12, 2024
•
edited
Loading
edited
- new functionality
- change gql mutation uploads to use fetch
- puts reusable stuff in places where it can be reused
const uploadFile = useMutation( | ||
(formData) => { | ||
const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_REGISTRATION, shortName)); | ||
return uploadFileRequest(url, formData, egoJwt); |
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.
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".
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.
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
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.
it's a different way of doing it. this is how react-query
is does it. "hooks" way