17 lines
492 B
TypeScript
17 lines
492 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
import { withAuth, withPermission } from '@/lib/api/helpers';
|
||
|
|
import { errorResponse } from '@/lib/errors';
|
||
|
|
import { getMergeFields } from '@/lib/services/document-templates';
|
||
|
|
|
||
|
|
export const GET = withAuth(
|
||
|
|
withPermission('documents', 'view', async (req, ctx) => {
|
||
|
|
try {
|
||
|
|
const mergeFields = getMergeFields();
|
||
|
|
return NextResponse.json({ data: mergeFields });
|
||
|
|
} catch (error) {
|
||
|
|
return errorResponse(error);
|
||
|
|
}
|
||
|
|
}),
|
||
|
|
);
|