fix: 405 on write methods in Vercel (static GET optimization)

Route handlers with both GET and write methods get the GET statically
optimized on Vercel, which 405s POST/PUT/DELETE. Add
export const dynamic = 'force-dynamic' to all 7 affected routes
(settings, posts, custom-pages, event-logs, links, conversations, reports).
This commit is contained in:
lezi-fun committed 2026-08-10 11:02:11 +08:00
1 parent d1c06741f6
commit 7ce81969ac
7 files changed
+27

No files matched your search

+4
View File
@@ -2,6 +2,10 @@
import pool from '@/lib/db';
import { getUser } from '@/lib/auth';
// 避免 GET 被静态优化导致写方法 405(动态接口,不能缓存)
export const dynamic = 'force-dynamic';
export async function GET(req) {
const user = getUser(req);
if (!user) {