Skip to content

Commit 1520e08

Browse files
committed
Fix jobs.html to read directly from Supabase
1 parent 6949bae commit 1520e08

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

jobs.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,12 @@ <h3>🗑️ Delete Job</h3>
294294
if (currentFilter !== 'all') params.set('type', currentFilter);
295295

296296
const queryStr = params.toString();
297-
const data = await api('GET', '/jobs' + (queryStr ? '?' + queryStr : ''));
298-
const jobs = data.jobs || [];
297+
const sbKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImN2a3h0c3ZnbnlueGV4bWVtZnV5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njc0MjE2NTEsImV4cCI6MjA4Mjk5NzY1MX0.2mys8Cc-ucJ1uLThEGJubeDEg1TvfIAkW-xFsR4ecq4';
298+
let sbUrl = 'https://api.simpaticohr.in/rest/v1/jobs?select=*,companies(name)&status=eq.active&order=created_at.desc';
299+
if (search) sbUrl += '&title=ilike.*' + encodeURIComponent(search) + '*';
300+
if (currentFilter !== 'all') sbUrl += '&employment_type=eq.' + currentFilter;
301+
const res = await fetch(sbUrl, { headers: { apikey: sbKey, Authorization: 'Bearer ' + sbKey } });
302+
const jobs = (await res.json()) || [];
299303

300304
if (!jobs.length) {
301305
el.innerHTML = `<div class="empty">

0 commit comments

Comments
 (0)