{"size": 590, "ext": "js", "max_stars_repo_path": "src/api/api.cases.js", "max_stars_repo_name": "manas2297/nanohealInterview", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/api/api.cases.js", "max_issues_repo_name": "manas2297/nanohealInterview", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/api/api.cases.js", "max_forks_repo_name": "manas2297/nanohealInterview", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.0952380952, "max_line_length": 68, "alphanum_fraction": 0.6372881356}
import Axios from "axios";

export const getCasesAPI = async params => {
  console.log(params)
  const url = 'https://bikewise.org:443/api/v2/incidents/';
  const response = await Axios.get(url, {
    params:{
      incident_type: 'theft',
      proximity: 'Berlin',
      query: params.searchKey || '',
      occurred_before: params.toDate || '',
      occurred_after: params.fromDate || '',
    }
  });
  const isSuccess = response.status >= 200 && response.status < 300;
  if (isSuccess) {
    return response.data;
  }
  const error = new Error('Something went wrong');
  throw error;
}