import {service , newsService} from ".";
import { Job } from "./types";
import {filter, from} from "rxjs"
import { AxiosResponse } from "axios";
export const getJobsByDept = async (department: string) => {
  return service.get<unknown, Job[]>(
    '/jobs',
    {
      params: {
        department: department
      }
    }
  )
}

export const getJobsById = async (id: string) => {
  return service.get<unknown, Job>(
    `/jobs/${id}`,
  )
}

export const getNews = async () => {
  let data: AxiosResponse<any, any>
  const res = newsService.get(`news/newsList`)
  const observable = from(res).pipe(filter(r=>r.data))
  return observable
}