feat : ask for noti
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { after } from "next/server";
|
||||
import { sendCommentReplyPush } from "@/lib/comments/push";
|
||||
import { sendCommentPush } from "@/lib/comments/push";
|
||||
import { getCommentViewer, listComments, requireCommentViewer } from "@/lib/comments/repository";
|
||||
import { publishComment } from "@/lib/comments/publish";
|
||||
import { errorResponse, HttpError, requireSameOrigin } from "@/lib/security/http";
|
||||
@@ -21,7 +21,7 @@ export async function POST(request: Request) {
|
||||
const target = new URL(request.url).searchParams.get("target");
|
||||
if (!target) throw new HttpError(400, "target-required");
|
||||
const result = await publishComment(request, viewer, { target });
|
||||
after(async () => { await sendCommentReplyPush(result.id).catch(() => console.error("Comment reply notification failed")); });
|
||||
after(async () => { await sendCommentPush(result.id).catch(() => console.error("Comment notification failed")); });
|
||||
return Response.json(result, { status: 201 });
|
||||
} catch (cause) { return errorResponse(cause); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user