mirror of
https://github.com/Traceworks2023/nxtgauge-admin-solid.git
synced 2026-06-10 20:01:28 +00:00
fix: use admin jobs endpoint in admin jobs management page
- Change fetch from /api/jobs to /api/admin/jobs - Adjust fields to match new endpoint: use salary_min/salary_max, posted_at, company_name
This commit is contained in:
parent
88a00db3bd
commit
65156aafde
1 changed files with 22 additions and 22 deletions
|
|
@ -48,7 +48,7 @@ export default function JobsManagementPage() {
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API}/api/jobs?limit=100`);
|
const res = await fetch(`${API}/api/admin/jobs`);
|
||||||
if (!res.ok) throw new Error('Fetch failed');
|
if (!res.ok) throw new Error('Fetch failed');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const list = Array.isArray(data) ? data : (data.jobs || []);
|
const list = Array.isArray(data) ? data : (data.jobs || []);
|
||||||
|
|
@ -56,11 +56,11 @@ export default function JobsManagementPage() {
|
||||||
id: j.id,
|
id: j.id,
|
||||||
name: j.title || '—',
|
name: j.title || '—',
|
||||||
title: j.title || '—',
|
title: j.title || '—',
|
||||||
company: j.company_name || j.client_name || '—',
|
company: j.company_name || '—',
|
||||||
location: j.location || '—',
|
location: j.location || '—',
|
||||||
rate: j.hourly_rate_min ? `₹${j.hourly_rate_min}–₹${j.hourly_rate_max ?? j.hourly_rate_min}/hr` : '—',
|
rate: j.salary_min || j.salary_max ? `$${j.salary_min || 0}–$${j.salary_max || j.salary_min}/hr` : '—',
|
||||||
status: (j.status || 'ACTIVE').toUpperCase(),
|
status: (j.status || 'ACTIVE').toUpperCase(),
|
||||||
postedDate: j.created_at ? new Date(j.created_at).toLocaleDateString() : '—',
|
postedDate: j.posted_at || j.created_at ? new Date(j.posted_at || j.created_at).toLocaleDateString() : '—',
|
||||||
updatedAt: j.updated_at || ''
|
updatedAt: j.updated_at || ''
|
||||||
} as JobRecord)));
|
} as JobRecord)));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue