File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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">
You can’t perform that action at this time.
0 commit comments