import { environment } from '../../enviroments/enviroments';
import axios from 'axios';

export function getEventsJournalList(token: any, page: any): any {
  const { localhost, localeRu, apiPrefix, eventsJournal } = environment;

  console.log('getEventsJournalList api');
  return axios({
    method: 'get',
    baseURL: `${localhost + localeRu}`,
    url: `api/elastic/query/aggregated-2022.03.18?from=0&size=10&track_total_hits=true`,
    headers: {
      Authorization: `Token ${token}`,
      // "Content-Type": "application/json",
    },
    // mode: 'no-cors',
    data: {
      filter: [
        { field: 'importance', filter_type: 'integer-range', value: '100;101' },
      ],
    },
  });
}

export function delEventsJournalRecord(token: any, id: any): any {
  return axios({
    method: 'delete',
    baseURL: `${
      environment.localhost + environment.localeRu + environment.apiPrefix
    }`,
    url: `${environment.endPoints.incidents.incident}${id}/`,
    headers: {
      Authorization: `Token ${token}`,
    },
  });
}
