diff --git a/src/routes/admin/jobs.tsx b/src/routes/admin/jobs.tsx index 1d9eeeb..01fde5f 100644 --- a/src/routes/admin/jobs.tsx +++ b/src/routes/admin/jobs.tsx @@ -46,28 +46,28 @@ export default function JobsManagementPage() { const [selectedJob, setSelectedJob] = createSignal(null); const [openMenuId, setOpenMenuId] = createSignal(null); - const load = async () => { - try { - const res = await fetch(`${API}/api/jobs?limit=100`); - if (!res.ok) throw new Error('Fetch failed'); - const data = await res.json(); - const list = Array.isArray(data) ? data : (data.jobs || []); - setRows(list.map((j: any) => ({ - id: j.id, - name: j.title || '—', - title: j.title || '—', - company: j.company_name || j.client_name || '—', - location: j.location || '—', - rate: j.hourly_rate_min ? `₹${j.hourly_rate_min}–₹${j.hourly_rate_max ?? j.hourly_rate_min}/hr` : '—', - status: (j.status || 'ACTIVE').toUpperCase(), - postedDate: j.created_at ? new Date(j.created_at).toLocaleDateString() : '—', - updatedAt: j.updated_at || '' - } as JobRecord))); - } catch (e) { - console.error('Jobs load error:', e); - setRows([]); - } - }; + const load = async () => { + try { + const res = await fetch(`${API}/api/admin/jobs`); + if (!res.ok) throw new Error('Fetch failed'); + const data = await res.json(); + const list = Array.isArray(data) ? data : (data.jobs || []); + setRows(list.map((j: any) => ({ + id: j.id, + name: j.title || '—', + title: j.title || '—', + company: j.company_name || '—', + location: j.location || '—', + rate: j.salary_min || j.salary_max ? `$${j.salary_min || 0}–$${j.salary_max || j.salary_min}/hr` : '—', + status: (j.status || 'ACTIVE').toUpperCase(), + postedDate: j.posted_at || j.created_at ? new Date(j.posted_at || j.created_at).toLocaleDateString() : '—', + updatedAt: j.updated_at || '' + } as JobRecord))); + } catch (e) { + console.error('Jobs load error:', e); + setRows([]); + } + }; onMount(() => void load());