diff --git a/app/api/users/route.ts b/app/api/users/route.ts index 0bdfb40..82c7918 100644 --- a/app/api/users/route.ts +++ b/app/api/users/route.ts @@ -54,8 +54,8 @@ export async function GET(request: NextRequest) { GROUP BY judge_id ) review_stats ON u.id = review_stats.judge_id ORDER BY u.created_at DESC - LIMIT ? OFFSET ? - `, [limit, offset]); + LIMIT ${limit} OFFSET ${offset} + `); // 分頁資訊 const totalPages = Math.ceil(total / limit); diff --git a/components/admin/admin-layout.tsx b/components/admin/admin-layout.tsx index 160cd7c..80a1426 100644 --- a/components/admin/admin-layout.tsx +++ b/components/admin/admin-layout.tsx @@ -171,7 +171,7 @@ export function AdminLayout({ children, currentPage, onPageChange }: AdminLayout setShowLogoutDialog(false) // Check if this is a popup/new tab opened from main site - if (window.opener && !window.opener.closed) { + if (typeof window !== 'undefined' && window.opener && !window.opener.closed) { // If opened from another window, close this tab and focus parent window.opener.focus() window.close() @@ -214,7 +214,7 @@ export function AdminLayout({ children, currentPage, onPageChange }: AdminLayout - {window.opener && !window.opener.closed && ( + {typeof window !== 'undefined' && window.opener && !window.opener.closed && (