mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
feat: add recipient creation
This commit is contained in:
@ -1,5 +1,17 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
import { createNextRouter } from '@documenso/api/next';
|
||||
import { ApiContractV1 } from '@documenso/api/v1/contract';
|
||||
import { ApiContractV1Implementation } from '@documenso/api/v1/implementation';
|
||||
|
||||
export default createNextRouter(ApiContractV1, ApiContractV1Implementation);
|
||||
const nextRouteHandler = createNextRouter(ApiContractV1, ApiContractV1Implementation, {
|
||||
responseValidation: false,
|
||||
});
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
// TODO: Dirty hack to make ts-rest handler work with next.js in a more intuitive way.
|
||||
req.query['ts-rest'] = Array.isArray(req.query['ts-rest']) ? req.query['ts-rest'] : []; // Make `ts-rest` an array.
|
||||
req.query['ts-rest'].unshift('api', 'v1'); // Prepend our base path to the array.
|
||||
|
||||
return await nextRouteHandler(req, res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user