mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
feat: allow multipart requests for public api
Adds support for multipart/form-data requests in the public api allowing documents to be uploaded without having to perform a secondary request. Need to rollout further endpoints for envelopes and templates. Need to change how we store files to not use `putFileServerSide`
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { DataTransformer } from '@trpc/server';
|
||||
import SuperJSON from 'superjson';
|
||||
|
||||
export const dataTransformer: DataTransformer = {
|
||||
serialize: (data: unknown) => {
|
||||
if (data instanceof FormData) {
|
||||
return data;
|
||||
}
|
||||
|
||||
return SuperJSON.serialize(data);
|
||||
},
|
||||
deserialize: (data: unknown) => {
|
||||
return SuperJSON.deserialize(data);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user