22 lines
650 B
TypeScript
22 lines
650 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
import { withAuth, withPermission } from '@/lib/api/helpers';
|
||
|
|
import { dismissReminder } from '@/lib/services/reminders.service';
|
||
|
|
import { errorResponse } from '@/lib/errors';
|
||
|
|
|
||
|
|
export const POST = withAuth(
|
||
|
|
withPermission('reminders', 'edit_own', async (_req, ctx, params) => {
|
||
|
|
try {
|
||
|
|
const data = await dismissReminder(params.id!, ctx.portId, {
|
||
|
|
userId: ctx.userId,
|
||
|
|
portId: ctx.portId,
|
||
|
|
ipAddress: ctx.ipAddress,
|
||
|
|
userAgent: ctx.userAgent,
|
||
|
|
});
|
||
|
|
return NextResponse.json({ data });
|
||
|
|
} catch (error) {
|
||
|
|
return errorResponse(error);
|
||
|
|
}
|
||
|
|
}),
|
||
|
|
);
|