The bell polls the unread count every 30 s while the tab is visible. Opening it loads the newest 10 and marks the unread ones read; items link only to paths on this site. /notifications lists all with paging and Mark all read. Titles and bodies render from message codes, in English and Chinese. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
13 lines
545 B
TypeScript
13 lines
545 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { callMobileApi } from "@/app/lib/server/mobileApi";
|
|
import { getToken } from "@/app/lib/server/session";
|
|
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
|
|
|
|
export async function POST() {
|
|
const token = await getToken();
|
|
if (!token) return unauthorized();
|
|
const result = await callMobileApi<{ count: number }>("/api/admin/notifications/read-all", { method: "POST", token });
|
|
if (!result.ok) return errorResponse(result);
|
|
return NextResponse.json(result.data);
|
|
}
|