From 39d1eff80f14168bfccb37ef11e2f1f67426e2fe Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Thu, 25 Dec 2025 21:49:09 -0300 Subject: [PATCH] fix(frontend): fix string/number ID comparison in jobs page - handleDeleteJob: compare string IDs directly instead of parseInt - handleSaveEdit: use string ID for future update logic - IDs are now UUIDs (strings) after migration --- frontend/src/app/dashboard/jobs/page.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/dashboard/jobs/page.tsx b/frontend/src/app/dashboard/jobs/page.tsx index 09ba499..2a43422 100644 --- a/frontend/src/app/dashboard/jobs/page.tsx +++ b/frontend/src/app/dashboard/jobs/page.tsx @@ -173,12 +173,9 @@ export default function AdminJobsPage() { setIsEditDialogOpen(true) } - const handleDeleteJob = async (idStr: string) => { + const handleDeleteJob = async (id: string) => { if (!confirm("Are you sure you want to delete this job?")) return - const id = parseInt(idStr) - if (isNaN(id)) return - try { // await adminJobsApi.delete(id) setJobs((prevJobs) => prevJobs.filter((job) => job.id !== id)) @@ -190,13 +187,11 @@ export default function AdminJobsPage() { const handleSaveEdit = async () => { if (!selectedJob) return - const id = parseInt(selectedJob.id) - if (isNaN(id)) return try { setIsLoading(true) - // const updated = await adminJobsApi.update(id, editForm) - // setJobs((prev) => prev.map((j) => (j.id === id ? updated : j))) + // const updated = await adminJobsApi.update(selectedJob.id, editForm) + // setJobs((prev) => prev.map((j) => (j.id === selectedJob.id ? updated : j))) setIsEditDialogOpen(false) } catch (error) { console.error("Failed to update job:", error)