feat: update routing and API handling, improve query functionality, and enhance UI components
- Changed import path for routes in next-env.d.ts - Updated dependencies in package.json, including @kevisual/api and @kevisual/query - Added delete functionality in QueryView component - Modified run function in studio to accept a custom type - Enhanced searchRoutes function in studio store with Fuse.js for better filtering - Updated DataItemForm to use QueryRouterServer from the browser - Added dynamic URL handling in query module - Improved proxy request handling based on app key - Adjusted TypeScript configuration for stricter checks - Created a new page component for dynamic routing - Introduced a new Toaster component for notifications
This commit is contained in:
@@ -46,12 +46,19 @@ async function proxyRequest(request: NextRequest, targetHost: string): Promise<N
|
||||
|
||||
export async function proxy(request: NextRequest) {
|
||||
const { pathname } = request.nextUrl;
|
||||
const method = request.method;
|
||||
const [username, appKey] = pathname.split('/').filter(Boolean);
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const path = searchParams.get('path') || '';
|
||||
// 代理 /api 请求
|
||||
if (pathname.startsWith('/api')) {
|
||||
return proxyRequest(request, API_URL);
|
||||
}
|
||||
// 代理 /root/home 或 /root/home/ 请求 (第二个路径段后可以为空或以 / 结尾)
|
||||
if (pathname.startsWith('/root')) {
|
||||
if (pathname.startsWith('/root') && appKey !== 'v1') {
|
||||
return proxyRequest(request, API_URL);
|
||||
}
|
||||
if (pathname.startsWith('/root') && path && appKey === 'v1') {
|
||||
return proxyRequest(request, API_URL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user