diff --git a/src/renderer/api/utils.ts b/src/renderer/api/utils.ts new file mode 100644 index 00000000..e6cf48e2 --- /dev/null +++ b/src/renderer/api/utils.ts @@ -0,0 +1,10 @@ +import { AxiosHeaders } from 'axios'; +import { z } from 'zod'; + +// Since ts-rest client returns a strict response type, we need to add the headers to the body object +export const resultWithHeaders = (itemSchema: ItemType) => { + return z.object({ + data: itemSchema, + headers: z.instanceof(AxiosHeaders), + }); +};