import jsonp from './jsonpConfig';

export function searchAutoCity(keywords) {
  const url = 'https://restapi.amap.com/v3/assistant/inputtips';
  const options = {
    callback: `jsonp_${new Date().getTime()}`,
  };
  const params = Object.assign(
    {},
    {
      s: 'rsv3',
      key: 'e83f64300a2a55a33fa8e4ab9a46bca6',
      platform: 'JS',
      logversion: '2.0',
      csid: '5A098355-8164-41D5-A2DC-78E1471CCD28',
      appname: window.location.href,
      sdkversion: '1.4.15',
      keywords: keywords,
    },
  );

  return jsonp(url, params, options);
}
