Refine auth, API proxy, and server routing

This commit is contained in:
Developer
2026-05-18 15:16:46 +08:00
parent 4ad1766f10
commit d10dd53884
9 changed files with 88 additions and 17 deletions
+12 -2
View File
@@ -1,7 +1,17 @@
export default async function handler(req, res) {
const { 0: path } = req.query;
const path = Array.isArray(req.query.path)
? req.query.path.join('/')
: req.query.path;
const backendUrl = `http://localhost:3501/${path}`;
if (!path) {
res.status(400).json({ error: 'Missing API path' });
return;
}
const query = { ...req.query };
delete query.path;
const searchParams = new URLSearchParams(query);
const backendUrl = `http://localhost:3501/api/${path}${searchParams.size ? `?${searchParams}` : ''}`;
const response = await fetch(backendUrl, {
method: req.method,
+1 -1
View File
@@ -12,7 +12,7 @@ import { formatMoney, parseDateTime, getDatePart } from '../lib/utils';
export default function Search() {
const router = useRouter();
const { showToast } = useToast();
const confirm = useConfirm();
const { confirm } = useConfirm();
const { categories, error: categoriesError } = useCategories();
// 显示分类加载错误