diff --git a/src/app/dashboard/result-formatter/history/_components/historyTable.tsx b/src/app/dashboard/result-formatter/history/_components/historyTable.tsx index fb4f024..b019321 100644 --- a/src/app/dashboard/result-formatter/history/_components/historyTable.tsx +++ b/src/app/dashboard/result-formatter/history/_components/historyTable.tsx @@ -32,7 +32,6 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { Input } from "@/components/ui/input"; import { Table, TableBody, @@ -49,6 +48,7 @@ import { mutate } from "swr"; import { ExamResultSingleApiType } from "@/app/api/secure/sbte-result/single/[resultId]/route"; import { convertToXlsx } from "@/app/lib/main"; import { writeFile } from "xlsx-js-style"; +import { Skeleton } from "@/components/ui/skeleton"; const handleResultDownload = (id: string) => { axios @@ -197,7 +197,7 @@ export const columns: ColumnDef[] = [ ]; export function HistoryTable() { - const { data: apiData } = useGet( + const { data: apiData, isLoading } = useGet( "/api/secure/sbte-result/history" ); @@ -245,6 +245,13 @@ export function HistoryTable() { ))} + {isLoading && ( + + + + + + )} {table.getRowModel().rows?.length > 0 ? ( table.getRowModel().rows.map((row) => ( ) { + return ( +
+ ) +} + +export { Skeleton } diff --git a/src/middleware.ts b/src/middleware.ts index 1b0be03..608721e 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -3,6 +3,12 @@ import { NextResponse, NextRequest } from "next/server"; import { fetchUserId, getUserId } from "@/components/auth/server"; export async function middleware(req: NextRequest) { + // If localHost is true, we are running in development mode, so we can skip authentication + const localHost = req.headers.get("host")?.startsWith("localhost"); + if (localHost) { + return NextResponse.next(); + } + try { const hanko = req.cookies.get("hanko")?.value; if (!hanko) {