import { apiWorker } from './api';

export const getFetchJobId = async (jobId) => {
  return apiWorker.get('/job/getJobId', {
    params: {
      jobId,
    },
  });
};

export const handlderJobFetch = async (jobId, jobValue, worker) => {
  if (!(jobId && jobValue)) {
    return false;
  }

  return apiWorker.post('/job/handlerJobFetch', {
    jobId,
    jobValue,
    worker: worker || '',
  });
};

export const getJobFetchWorkerId = async (jobId) => {
  return apiWorker.get('/job/getJobFetchWorkerId', {
    params: {
      jobId,
    },
  });
};

export const handlerJobFetchWorkerId = async (jobId, jobValue) => {
  if (!(jobId && jobValue)) {
    return false;
  }

  return apiWorker.post('/job/handlerJobFetchWorkerId', {
    jobId,
    jobValue,
  });
};
