28 lines
778 B
TypeScript
28 lines
778 B
TypeScript
import { getCloudViewer } from "@/app/cloud-auth";
|
|
import { DomainError } from "@/db/repository";
|
|
import { apiError, readJsonMutation } from "../../respond";
|
|
|
|
export async function POST(request: Request) {
|
|
try {
|
|
const viewer = await getCloudViewer();
|
|
if (!viewer) {
|
|
return Response.json(
|
|
{ error: "authentication_required", message: "请先登录" },
|
|
{ status: 401 },
|
|
);
|
|
}
|
|
await readJsonMutation<{
|
|
period?: "month" | "year";
|
|
quantity?: number;
|
|
idempotencyKey?: string;
|
|
}>(request);
|
|
throw new DomainError(
|
|
"paid_features_deferred",
|
|
"免费公测阶段不提供报价或订单;未来收费方案确定后会另行通知",
|
|
409,
|
|
);
|
|
} catch (error) {
|
|
return apiError(error);
|
|
}
|
|
}
|