mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Add function to modify base response
This commit is contained in:
@@ -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 = <ItemType extends z.ZodTypeAny>(itemSchema: ItemType) => {
|
||||||
|
return z.object({
|
||||||
|
data: itemSchema,
|
||||||
|
headers: z.instanceof(AxiosHeaders),
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user