mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
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`
16 lines
362 B
TypeScript
16 lines
362 B
TypeScript
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);
|
|
},
|
|
};
|