fix: restore credentials section and add missing User migration
- Use useAuth() in CredentialTable instead of a separate /api/users/ fetch that was failing silently and hiding the entire credentials section - Add migration for autoBackupEnabled/usbBackupEnabled columns on User that were in the Prisma schema but missing from the database, causing a 500 error on login Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 <p>Loading user...</p>;
|
||||
if (isUserError) return <p>Error loading user</p>;
|
||||
|
||||
return (
|
||||
<div className="bg-white shadow rounded-lg overflow-hidden">
|
||||
<div className="flex justify-between items-center p-4 border-b border-gray-200">
|
||||
|
||||
Reference in New Issue
Block a user