Skip to content

Commit

Permalink
[FIX] FormData uploads not working (#25069)
Browse files Browse the repository at this point in the history
* fix useEndpointUpload hook

* chore: remove log

Co-authored-by: dougfabris <devfabris@gmail.com>
  • Loading branch information
2 people authored and sampaiodiego committed Apr 7, 2022
1 parent b50b84c commit d0e84b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/hooks/useEndpointUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export const useEndpointUpload = (
endpoint: string,
params = {},
successMessage: string,
): ((...args: any[]) => Promise<{ success: boolean }>) => {
): ((formData: FormData) => Promise<{ success: boolean }>) => {
const sendData = useUpload(endpoint);
const dispatchToastMessage = useToastMessageDispatch();

return useCallback(
async (...args) => {
async (formData: FormData) => {
try {
const data = sendData(params, [...args]);
const data = sendData(params, formData);

const promise = data instanceof Promise ? data : data.promise;

Expand Down

0 comments on commit d0e84b7

Please sign in to comment.