feat: migrate nextjs to rr7

This commit is contained in:
David Nguyen
2025-01-02 15:33:37 +11:00
parent 9183f668d3
commit 383b5f78f0
898 changed files with 31175 additions and 24615 deletions

View File

@ -1,19 +1,24 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { validateApiToken } from '@documenso/lib/server-only/webhooks/zapier/validateApiToken';
export const testCredentialsHandler = async (req: NextApiRequest, res: NextApiResponse) => {
export const testCredentialsHandler = async (req: Request) => {
try {
const { authorization } = req.headers;
const authorization = req.headers.get('authorization');
if (!authorization) {
throw new Error('Missing authorization header');
}
const result = await validateApiToken({ authorization });
return res.status(200).json({
return Response.json({
name: result.team?.name ?? result.user.name,
});
} catch (err) {
return res.status(500).json({
message: 'Internal Server Error',
});
return Response.json(
{
message: 'Internal Server Error',
},
{ status: 500 },
);
}
};