chore: add prettier formatting
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
This commit is contained in:
@@ -9,7 +9,7 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ error: "Web Push is not configured." }, { status: 503 });
|
||||
}
|
||||
|
||||
const body = await request.json().catch(() => null) as { endpoint?: unknown } | null;
|
||||
const body = (await request.json().catch(() => null)) as { endpoint?: unknown } | null;
|
||||
if (typeof body?.endpoint !== "string" || !body.endpoint) {
|
||||
return NextResponse.json({ error: "Invalid push subscription endpoint." }, { status: 400 });
|
||||
}
|
||||
@@ -23,7 +23,8 @@ export async function POST(request: Request) {
|
||||
await sendTestNotification(subscription);
|
||||
return NextResponse.json({ ok: true });
|
||||
} catch (error) {
|
||||
const statusCode = typeof error === "object" && error !== null && "statusCode" in error ? Number(error.statusCode) : null;
|
||||
const statusCode =
|
||||
typeof error === "object" && error !== null && "statusCode" in error ? Number(error.statusCode) : null;
|
||||
if (statusCode === 404 || statusCode === 410) removePushSubscription(subscription.endpoint);
|
||||
return NextResponse.json({ error: "Unable to send test notification." }, { status: 502 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user