get uploads working again (#3679)

I'm not sure if this was just my local install, but even after a fresh
`yarn install` my upload network request was failing because no file was
passed in. I don't think the `bodySerializer` part is getting run
This commit is contained in:
Lincoln Stein 2023-07-07 21:34:51 -04:00 committed by Lincoln Stein
parent 8e8f9cce0f
commit b11d5970f6

View File

@ -157,6 +157,8 @@ export const imageUploaded = createAppAsyncThunk<
session_id, session_id,
} = arg; } = arg;
const { post } = $client.get(); const { post } = $client.get();
const formData = new FormData();
formData.append('file', file);
const { data, error, response } = await post('/api/v1/images/', { const { data, error, response } = await post('/api/v1/images/', {
params: { params: {
query: { query: {
@ -165,12 +167,8 @@ export const imageUploaded = createAppAsyncThunk<
session_id, session_id,
}, },
}, },
body: { file }, // @ts-ignore
bodySerializer: (body) => { body: formData
const formData = new FormData();
formData.append('file', body.file);
return formData;
},
}); });
if (error) { if (error) {
@ -217,7 +215,7 @@ export const imageDeleted = createAppAsyncThunk<
type UpdateImageArg = type UpdateImageArg =
paths['/api/v1/images/{image_name}']['patch']['requestBody']['content']['application/json'] & paths['/api/v1/images/{image_name}']['patch']['requestBody']['content']['application/json'] &
paths['/api/v1/images/{image_name}']['patch']['parameters']['path']; paths['/api/v1/images/{image_name}']['patch']['parameters']['path'];
type UpdateImageResponse = type UpdateImageResponse =
paths['/api/v1/images/{image_name}']['patch']['responses']['200']['content']['application/json']; paths['/api/v1/images/{image_name}']['patch']['responses']['200']['content']['application/json'];