mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
11 lines
350 B
TypeScript
11 lines
350 B
TypeScript
|
|
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),
|
||
|
|
});
|
||
|
|
};
|