diff --git a/apps/Frontend/src/components/settings/insuranceCredTable.tsx b/apps/Frontend/src/components/settings/insuranceCredTable.tsx index 76bb956..fbe2502 100755 --- a/apps/Frontend/src/components/settings/insuranceCredTable.tsx +++ b/apps/Frontend/src/components/settings/insuranceCredTable.tsx @@ -5,6 +5,7 @@ import { Button } from "../ui/button"; import { Edit, Delete, Plus } from "lucide-react"; import { CredentialForm } from "./InsuranceCredForm"; import { DeleteConfirmationDialog } from "../ui/deleteDialog"; +import { useAuth } from "@/hooks/use-auth"; type Credential = { id: number; @@ -15,20 +16,7 @@ type Credential = { export function CredentialTable() { const queryClient = useQueryClient(); - - // Fetch current user - const { - data: currentUser, - isLoading: isUserLoading, - isError: isUserError, - } = useQuery({ - queryKey: ["/api/users/"], - queryFn: async () => { - const res = await apiRequest("GET", "/api/users/"); - if (!res.ok) throw new Error("Failed to fetch user"); - return res.json(); - }, - }); + const { user: currentUser } = useAuth(); const [currentPage, setCurrentPage] = useState(1); const [modalOpen, setModalOpen] = useState(false); @@ -86,9 +74,6 @@ export function CredentialTable() { const currentCredentials = credentials.slice(indexOfFirst, indexOfLast); const totalPages = Math.ceil(credentials.length / credentialsPerPage); - if (isUserLoading) return

Loading user...

; - if (isUserError) return

Error loading user

; - return (
diff --git a/packages/db/prisma/migrations/20260416000000_add_user_backup_fields/migration.sql b/packages/db/prisma/migrations/20260416000000_add_user_backup_fields/migration.sql new file mode 100644 index 0000000..30d2191 --- /dev/null +++ b/packages/db/prisma/migrations/20260416000000_add_user_backup_fields/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "autoBackupEnabled" BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "usbBackupEnabled" BOOLEAN NOT NULL DEFAULT false;