fix: restore dark post view and API revalidation
This commit is contained in:
1 parent
5c554f27ea
commit
0933220c70
12 files changed
+100
-31
No files matched your search
@@ -1,5 +1,6 @@
|
||||
// GET /api/users/profile/:username — 用户公开信息(无需登录,用于用户主页)
|
||||
import pool from '@/lib/db';
|
||||
import { jsonWithEtag } from '@/lib/http-cache';
|
||||
|
||||
export async function GET(req, { params }) {
|
||||
const { username } = await params;
|
||||
@@ -14,7 +15,7 @@ export async function GET(req, { params }) {
|
||||
if (r.rows.length === 0) {
|
||||
return Response.json({ error: '用户不存在' }, { status: 404 });
|
||||
}
|
||||
return Response.json(r.rows[0]);
|
||||
return jsonWithEtag(req, r.rows[0]);
|
||||
} catch {
|
||||
return Response.json({ error: '服务器错误' }, { status: 500 });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user